By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

Passing parameter to ADO recordset from Field

P: n/a
Is there a simple way to pass a parameter to an ADO recordset instead
of using a hard coded where statement like below(something like
forms!aaa!fieldname). I've done a fair bit of searching but can not
seem to come up with a way to provide this in a simple manner. I have
done this using pass through queries and stored procedures (as a form
based search method)but I guess I am just experimenting to see if the
below is a more efficient way to search large recordsets by passing
parameters from a form or am I just wasting my time
The db in question references both DAO ADO recordsets.

Public Function test4()
Dim cnn As ADODB.connection
Dim rst As ADODB.Recordset
Dim strSQL As String
Set cnn = New ADODB.connection
Set rst = New ADODB.Recordset
strSQL = "SELECT street, town, id, " & _
"telephoneid " & _
"FROM tble where street like 's%'"
cnn.Open "DSN=do;Description=do;APP=" & _
"Microsoft Office XP;WSID=;DATABASE=" & _
rst.Open strSQL, cnn
Forms!aaa.RecordSource = strSQL
Set rst = Nothing
Set cnn = Nothing
End Function

Thanks for any assistance

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.