gopher_by_fende
Registered User.
- Local time
- Today, 00:28
- Joined
- May 21, 2005
- Messages
- 18
Hi,
i'm pretty new to VBA so you'll have to bare with me. i'm currently making a search form for a new database, and ive got as far as getting the searching part done. what i can't figure out is how to get the results from the recordset in VBA onto a subform on the main search form.
the code for the search is -
Private Function cmdSearchSQL() As Variant
Dim strSearchtype As String
Dim strSearch As String
Dim strSQL As String
Dim db As Database
Dim rs As Recordset
strSearchtype = Form_frmJobIndex!txtSearchtype
strSearch = Form_frmJobIndex!txtSearch
strSQL = "SELECT * FROM jobs_query WHERE '" & strSearchtype & "'= '" & strSearch & "';"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Set db = Nothing
Set rs = Nothing
End Function
Obviously im missing something, buti dont know what. also, the code above is probably less than perfect, but as i said im new to VBA and im learning the code as i go!!
Thanks for any help
Phil
i'm pretty new to VBA so you'll have to bare with me. i'm currently making a search form for a new database, and ive got as far as getting the searching part done. what i can't figure out is how to get the results from the recordset in VBA onto a subform on the main search form.
the code for the search is -
Private Function cmdSearchSQL() As Variant
Dim strSearchtype As String
Dim strSearch As String
Dim strSQL As String
Dim db As Database
Dim rs As Recordset
strSearchtype = Form_frmJobIndex!txtSearchtype
strSearch = Form_frmJobIndex!txtSearch
strSQL = "SELECT * FROM jobs_query WHERE '" & strSearchtype & "'= '" & strSearch & "';"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Set db = Nothing
Set rs = Nothing
End Function
Obviously im missing something, buti dont know what. also, the code above is probably less than perfect, but as i said im new to VBA and im learning the code as i go!!
Thanks for any help
Phil