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 :

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

what am i missing here. The errri comes up on the "Data1.Recordset.FindFirst.store" line

I'm pretty sure that you can't use a variable name as a property of an object..... you could try this instead:

Data1.Recordset.FindFirst(store) ' might work

I have to use access due to college criteria. Im searching the "tittle" in the database.
usualy i say :

data1.recordset.findfirst.store

this problem also occurs when attempting to add a record

is the title is entity if entity use this


data1.recordsource = ("Select * from name_of_the_table where title - '" & store 7 "'")


regards
Ryan Riel

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

store = txtsearch.Text
mycriteria = "title =" & "'" & store & "'"
Data1.Recordset.FindFirst mycriteria
data1.recordset.movenext

This article has been dead for over six months. Start a new discussion instead.