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

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

P: 1
Hello,

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.
Cheers
Feb 27 '07 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,489
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.