comboy
Instructor
- May 23, 2003
- 226
Hi all,
I'm trying to teach myself VB and am using unbound forms as advised, my question is how can I use an InputBox to allow users search for records using words and phrases and return the first record that matches the text entered into the InputBox if they are held in an Access DB.
I've tried the following code and am getting an invalid bookmark error in VB6
Thanks in advance for the help,
Graham.
I'm trying to teach myself VB and am using unbound forms as advised, my question is how can I use an InputBox to allow users search for records using words and phrases and return the first record that matches the text entered into the InputBox if they are held in an Access DB.
I've tried the following code and am getting an invalid bookmark error in VB6
Code:
Private Sub cmdSearch_Click()
Dim SearchVar As String
SearchVar = InputBox("Enter a Word or Phrase to search for")
Sales.MoveFirst
Sales.Find "HowTo LIKE '*[SearchVar}*'", , adSearchForward, [SearchVar]
LoadData
End Sub
Private Sub Form_Load()
Set conn = New Connection
Set Sales = New Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Program Files\QicLEARNQicPOS\Data1\QicLEARNQPOS.mdb"
Sales.Open "SELECT * FROM tblHowTo WHERE [Category]='Sales Entry'", conn, adOpenStatic, adLockReadOnly, adCmdText
LoadData
Me.Left = 0
Me.Top = 0
End Sub
Thanks in advance for the help,
Graham.