Dyanamically populating SubForm

prodigy

Registered User.
Local time
Today, 06:02
Joined
Apr 22, 2005
Messages
66
I have a form (Form1) with subform (SForm1) embedded in it. Now my Form1 is based on query (query with search criteria) which is dynamically linked (with VBA code). I want to populate SForm1 dynamically with records based on one field (customerID) of Form1.
I am able to populate Form1 with search query, however, the SForm1(subform) is not populated. The SForm1 is based on query with criteria which is supplied by (customerID) in the Form1.
Any help is appreciated.
Thankx in advance.
Prodigy.
 
Link Master to Child

Have you linked the forms with CustomerID (NB Text box Name not fieldname)
 
Firstly, Thankx for your time. I realize that I should have been more clear in explaining the problem.
I am using 2 unbound forms [Form1 and SForm1 (subform)]. I populate Form1 with VBA code (query) and I want the (subform) SForm1 to be populated with the criteria field in Form1.
Now I am able to bind the Form1 but not SForm1.

e.g.
rst.Open "Select * From Table1"
Set Forms("Form1").Recordset = rst
Me!Txt_Name = rst.Fields("customerID")

/* The above lines bind Form1 with recordset (rst)
and displays customerID */

My SForm1 will show results based on 'customerID' on Form1 and I want to bind the respective sql-code VBA with the (subform) SForm1.

Awaiting any assistance
Prodigy.
 
To bind Subform dynamically

Firstly, Thankx for your time. I realize that I should have been more clear in explaining the problem.
I am using 2 unbound forms [Form1 and SForm1 (subform)]. I populate Form1 with VBA code (query) and I want the (subform) SForm1 to be populated with the criteria field in Form1.
Now I am able to bind the Form1 but not SForm1.

e.g.
rst.Open "Select * From Table1"
Set Forms("Form1").Recordset = rst
Me!Txt_Name = rst.Fields("customerID")

/* The above lines bind Form1 with recordset (rst)
and displays customerID */

My SForm1 will show results based on 'customerID' on Form1 and I want to bind the respective sql-code VBA with the (subform) SForm1.

Awaiting any assistance
Prodigy.
 
Master to Child

Essentially you need to bind the subform to a query on the main data. You can then link the form to Form1 with Master and Child. Does Form1 have just 1 record from the Table1 or if is there more than 1 record returned, why do you not bind it to a query? This way you won't need any more links.
 
Populate field based on criteria of previous field

Prodigy:
This thread's so old you may have moved on, but just in case... have you found a good solution?

I have a main table with new patient data (PatientTbl), including acct number, last and first names, etc. I want another table (ReferTbl) with referring data. The goal is when I enter the account number in ReferTbl, the name fields populate based on that account number, and the information is pulling from my PatientTbl.

I am very green when it comes to writing code!

Thanks for any help at all.
 

Users who are viewing this thread

Back
Top Bottom