Advertisement
5_2007-2008 Databases/ Data Access/ DAO/ ADO #181473

LDB Read and NetSend

I wanted a way to send messages to the users who are in an access database. This code opens and reads the ldb file for the database (that you specify on the form), reads the user names and sends a message....all without API calls. You can do a lot more with this obviously (I trimmed it down a lot for this forum). You will need one text box for the source of the ldb file (named txtLocation), one command button, and one text box for your message (named txtMsg).

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Private Sub Command1_Click()
'This simple code uses no api calls. it simply opens an ldb file that
'you choose (me.txtLocation) and places the the data in an Array
'For each variable in the array it shoots off a batch 'netsend'
'with a message you supply (me.txtmsg)
Dim strText As String
Dim vArray As Variant
Dim vParse As Variant
Dim iCount As Integer
   Open Me.txtLocation For Input As #1
   Input #1, strText
   For x = 1 To 25 'get rid of spaces-replace with single space
     strText = Replace(strText, " ", " ")
   Next
   strText = Replace(strText, " ", ",") 'replace all single spaces with a comma
   vArray = Split(strText, ",", -1) 'find all commas and split into an array
   For Each vParse In vArray
     iCount = iCount + 1 ' Get every other variable in Array (odd numbers)
     If iCount Mod 2 <> 0 Then
       RunBatch = Shell("net send " & _
           vParse & " "" " & txtmsg & """", vbNormalFocus)
     End If
   Next
   MsgBox "Message Sent"
   Close #1
End Sub
Original Comments (3)
Recovered from Wayback Machine