471,355 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,355 software developers and data experts.

A search that opens the subform of another form to a specific record


I'm somewhat new to this, and I definately need some help. I have a db for a small business, and I have a main form, Customer Info, which has a subform Appliance Info, which has a subform Service Call Info... these three forms are linked, and I run into a problem when I try to search through records. I set up a different form where the user can select a customer, after which he can either push a button and using that customer's information add a new appliance, or a second combo box appears that has a list of the appliances already on record for this customer. This is repeated for service calls after an appliance is selected. Now, my problem is not searching, I have that working, and I can find all the records no problem. I can open the main form, Customer Info with its Primary Key, but I have no clue how to open a subform with its primary key. I've tried many things and none have worked so I was hoping to find someone more brilliant than me here.

The code for one of the buttons looks like this:

Private Sub NewAppliance_Click()

DoCmd.OpenForm "Customer Info", , , "[Unique]=Forms![Search]!
[SelCustomer]", acEdit ---> this is supposed to open the main form

This middle part is my problem. I have the primary key for the Appliance Info form which is saved in an unbound field, and I just don't know how to reach the subform to pass this to it. :( I've looked and looked and I have a feeling I might be able to do this with the FindFirst method, but I don't really know how to set it up.

DoCmd.Close acForm, "Search" ---> this is just closing the search form after

End Sub

I would greatly appreciate your help, I'm in desperate need of it.
Feb 27 '07 #1
1 1555
32,405 Expert Mod 16PB
There is a tutorial which I think should help you to do exactly what you need (Example Filtering on a Form.). Let us know if this helps you. If not, let us know where you get stuck and we can help you get past it.
Feb 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Christopher Koh | last post: by
18 posts views Thread by natural | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.