This has to be easy

kschuster

New member
Local time
Today, 14:02
Joined
May 4, 2004
Messages
3
New to Access2002

I have created an unbound seach form. I'm using ADO to query a table. I want to display the results, if any, on the same form then allow the user to click into the result list for more detail.

What I can't figure out is how to display the result set. I have read the way to do it is to create a continous subform.

How do I get the data into the sub form? Does anyone have a working example of this?

Thanks
Keith
 
One thing you can do is leave ADO out of the whole thing like this:

SQLstring = " Select * from TableName"
Forms!FormName.RecordSource = SQLString

This will work on earlier versions of Access as well.

On AccessXP you can assign the recordset if you want to

Set cn = CurrentProject.Connection
Set rst = New ADODB.Recordset
SQLstring = " Select * from TableName"
Set rst = cn.Execute(SQLString)
Set Forms!FormName.RecordSet = rst

The only advantage of the latter version is that you will get a sensible error message is something goes wrong with your query.

hth.
SWK
 

Users who are viewing this thread

Back
Top Bottom