Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound Form/ Dynamic Query Problem

Status
Not open for further replies.

Jim2001

Technical User
Jun 28, 2001
2
US
I have made a form with unbound fields in it and the vba code for a dynamic query of all these fields. No Problem there, query works fine and displays results on Datasheet view only? What I want to do is either display the fields in a subform within this main form or popup a separate form with the results. The Dynamic query only searches 8 fields, but I would like my subform/form to show all the fields in table. Another problem when trying to setup a subform is the parent/Child links to subform. Since all the fields in my query form are all unbound, it won't let me setup links to subform (and then it only let's you do 3-4 relationships).
I can make the form display separately by doing a DoCmd.OpenForm "Formname" but the original datasheet still pops up in the background, and that is coming from the DoCmd.OpenQuery "Dynamic_Query"

Please someone give me a push in the right direction, either getting rid of datasheet so I can pop separate form up or figure out why subform wont work??

Thks in Adv,

Jim
 
Do this
Copy the main form to a new one and use it.
Create a "bound" subform on your new main form. So you have all of the fields you want.

Then open the subform up and delete the Recordsource
you can pass the Query to a subform like so

Dim MyRecordSource as String
MyRecordSource = "Select * From YourTable Where Somefield = " & something

Me![YOURsubform].Form.RecordSource = MyRecordSource

One problem though with Access is if the table on the main form has a "primary key" to will always try to link the Child/Master on the subform.

So I NEVER create relationships in Access Period.
You can open the table and Index a field but don't have a Primnary key or any relationships in your database.

here is a sample of a Find on my WEB site.

;-)


DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top