Hi guys, hows it going?
Basically, I made an initial post in the general category and you can see it from here to get a little background:
http://www.access-programmers.co.uk/forums/showthread.php?t=144955
I have this code from "Guus2005" (thanks ever so much boss) that I altered for my DB, and it goes like this:
Private Sub Command0_Click()
Dim strSql As String
Dim dbs As Database
Dim rst As DAO.Recordset
strSql = "Select * from tbl_Products where [Product Name] = '" & strProductname & "' or [ISBN] = '" & strISBN & "' or [Author/Composer] = '" & strAuthor & "'"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSql)
If rst.RecordCount = 0 Then
MsgBox "Selection unsuccesfull"
Else
MsgBox "Found!"
End If
End Sub
I have assigned it to a button in a form and from clicking it it seems like its working, my only problem is that, upon clicking it I want it to use the value put inside the text box which is also in the form as the criteria for the search.
Could anyone help me on it at all please?
Thanks
Daniel
Basically, I made an initial post in the general category and you can see it from here to get a little background:
http://www.access-programmers.co.uk/forums/showthread.php?t=144955
I have this code from "Guus2005" (thanks ever so much boss) that I altered for my DB, and it goes like this:
Private Sub Command0_Click()
Dim strSql As String
Dim dbs As Database
Dim rst As DAO.Recordset
strSql = "Select * from tbl_Products where [Product Name] = '" & strProductname & "' or [ISBN] = '" & strISBN & "' or [Author/Composer] = '" & strAuthor & "'"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSql)
If rst.RecordCount = 0 Then
MsgBox "Selection unsuccesfull"
Else
MsgBox "Found!"
End If
End Sub
I have assigned it to a button in a form and from clicking it it seems like its working, my only problem is that, upon clicking it I want it to use the value put inside the text box which is also in the form as the criteria for the search.
Could anyone help me on it at all please?
Thanks
Daniel