home *** CD-ROM | disk | FTP | other *** search
- Listing One
- Option Explicit
-
- Private dbPiAccounts As Database
- Private rsPiCustomer As Recordset
-
- Private Sub txtCustomer_Enter()
- cmdSearch.Default = True
- End Sub
-
- Private Sub UserForm_Initialize()
- Set dbPiAccounts = DBEngine.OpenDatabase("d:\my documents\accounts 97.mdb", False, True)
- End Sub
-
- Private Sub cmdSearch_Click()
- Set rsPiCustomer = dbPiAccounts.OpenRecordset("SELECT * FROM customers WHERE name LIKE '" & txtCustomer & "*'", dbOpenSnapshot)
-
- If rsPiCustomer.EOF Then
- txtAddress = ""
- txtCustomer.SetFocus
- Else
- txtAddress = rsPiCustomer!Name & vbCrLf & _
- rsPiCustomer!address1 & vbCrLf & _
- rsPiCustomer!address2 & vbCrLf & _
- rsPiCustomer!address3 & vbCrLf & _
- rsPiCustomer!address4 & vbCrLf & _
- rsPiCustomer!postcode
-
- If chkInclude Then
- txtAddress = txtAddress & vbCrLf & rsPiCustomer!phonenumber
- End If
-
- cmdPaste.Default = True
- End If
-
- rsPiCustomer.Close
- End Sub
-
- Private Sub cmdPaste_Click()
- Selection.InsertAfter (txtAddress)
- Me.Hide
- End Sub
-
- Listing Two
- Public Sub CustomerAddress()
- frmCustomerAddress.Show
- End Sub
-
-