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

Help opening a new form based on a field selected on a subform

P: n/a
I have a form with a subform on it. On my main form, you select an
employee id number and the top portion of form fills in with data, and
the bottom portion of the form,which is a subform, lists existing
records there are for that employee (one to many relationship). How
can I set up my main form, so the user can select one of the records
on the subform and retain that recordid number for use in opening a
new form and displaying the that record?

I tried creating a text field and populating it when a record is
selected (ongetfocus) - Me!Text17 = frm!frmExistingLeavesSubForm!
RecordID

Doesn't seem to work - error message - runtime error 424 - object
required. Is this the right approach or is there a better way to do
this?
Thanks.

Jul 29 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Put the following code in the click event of one or more fields in your
subform:

DoCmd.OpenForm "NameOfYourNewForm",,,"[RecordID] = " & Me![RecordID

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
re******@pcdatasheet.com


"Coll" <co*********@hotmail.comwrote in message
news:11**********************@d55g2000hsg.googlegr oups.com...
>I have a form with a subform on it. On my main form, you select an
employee id number and the top portion of form fills in with data, and
the bottom portion of the form,which is a subform, lists existing
records there are for that employee (one to many relationship). How
can I set up my main form, so the user can select one of the records
on the subform and retain that recordid number for use in opening a
new form and displaying the that record?

I tried creating a text field and populating it when a record is
selected (ongetfocus) - Me!Text17 = frm!frmExistingLeavesSubForm!
RecordID

Doesn't seem to work - error message - runtime error 424 - object
required. Is this the right approach or is there a better way to do
this?
Thanks.

Jul 29 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.