| | |
Adding a search function
![]() |
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 0
OK im new to this so bear with me. I need to add a search function to my project. I need to input a value into a textbox, click a submit button and a screen needs to appear with the results
Ive got a the following code but i get errors :
what am i missing here. The errri comes up on the "Data1.Recordset.FindFirst.store" line
Ive got a the following code but i get errors :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdsubmit_click() 'Declare local variables Dim store As String store = txtsearch.Text mycriteria = "title =" & "'" & store & "'" Data1.Recordset.FindFirst.store If Data1.Recordset.NoMatch Then Data1.Recordset.MoveFirst MsgBox "Record not found", vbExclamation, "Error" End If End Sub
Last edited by Ancient Dragon; Jan 5th, 2009 at 3:19 pm. Reason: add code tags
I'm pretty sure that you can't use a variable name as a property of an object..... you could try this instead:
visualbasic Syntax (Toggle Plain Text)
Data1.Recordset.FindFirst(store) ' might work
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 0
this is driving me mental lol. My code is as follows but cant get it working.Do i need to have a hide/show function also to display the results?
Private Sub cmdsubmit_click()
'Declare local variables
Dim store As String
'Get the search information
store = txtsearch.Text
mycriteria = "title =" & "'" & store & "'"
Data1.Recordset.FindFirst mycriteria
If Data1.Recordset.NoMatch Then
Data1.Recordset.MoveFirst
MsgBox "Record not found", vbExclamation, "Error"
End If
End Sub
Private Sub cmdsubmit_click()
'Declare local variables
Dim store As String
'Get the search information
store = txtsearch.Text
mycriteria = "title =" & "'" & store & "'"
Data1.Recordset.FindFirst mycriteria
If Data1.Recordset.NoMatch Then
Data1.Recordset.MoveFirst
MsgBox "Record not found", vbExclamation, "Error"
End If
End Sub
![]() |
Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Audio volume control on vb6 form
- Next Thread: Retrieving query records on datareport
| Thread Tools | Search this Thread |
* 6 2007 access activex add age basic beginner birth bmp calculator cd cells.find click client code college connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit excel excelmacro file filename form header iamthwee image inboxinvb internetfiledownload listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading remotesqlserverdatabase report save search sendbyte sites sql sql2008 sqlserver subroutine tags time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web windows






