Zero_Hour
10-18-2000, 03:16 PM
Hello, I'm having a little trouble getting the database to add and search through. Was wandering if anyone has any idea's on how to get this code working right. And what I'm missing. I have adoc, and the data environment on. The database will load, and I can scroll at the data, and delete data, but not add and search/find. I'm encluding some of the code.
Thank you for any help.
Private Sub Command1_Click()
prompt$ = "To Enter a New Record click OK"
reply = MsgBox(prompt$, vbOKCancel, "Add New Record")
If reply = vbOK Then ' If the user clicks OK
txtText1.SetFocus 'move cursor to Text1 box
DataEnvironment1.rsCommand1.Recordset.AddNew ' and get new record
End If
End Sub
Private Sub Command2_Click()
prompt$ = "Enter the Trouble Ticket Number to start serch"
'get string to be used in the Trouble Ticket field serch
SearchStr$ = InputBox(prompt$, "Ticket Search")
DataEnvironment1.rsCommand1.Index = "Trouble Ticket" 'use Trouble Ticket
DataEnvironment1.rsCommand1.Seek "=", SearchStr$ 'and search
If DataEnvironment1.rsCommand1.NoMatch Then 'if no match
DataEnvironment1.rsCommand1.Recordset.MoveFirst 'go to first record
End If
End Sub
Thank you for any help.
Private Sub Command1_Click()
prompt$ = "To Enter a New Record click OK"
reply = MsgBox(prompt$, vbOKCancel, "Add New Record")
If reply = vbOK Then ' If the user clicks OK
txtText1.SetFocus 'move cursor to Text1 box
DataEnvironment1.rsCommand1.Recordset.AddNew ' and get new record
End If
End Sub
Private Sub Command2_Click()
prompt$ = "Enter the Trouble Ticket Number to start serch"
'get string to be used in the Trouble Ticket field serch
SearchStr$ = InputBox(prompt$, "Ticket Search")
DataEnvironment1.rsCommand1.Index = "Trouble Ticket" 'use Trouble Ticket
DataEnvironment1.rsCommand1.Seek "=", SearchStr$ 'and search
If DataEnvironment1.rsCommand1.NoMatch Then 'if no match
DataEnvironment1.rsCommand1.Recordset.MoveFirst 'go to first record
End If
End Sub