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!

How can I link a form to another form 1

Status
Not open for further replies.

lazarus

Technical User
Feb 27, 2001
3
US
How can I launch a form from an open form and link it so that it will show the appropriate records?
 
You can filter a form(or report's) recordsource when calling it via the DoCmd.OpenForm method. It is the {wherecondition} property. The wherecondition is a SQL WHERE statement without the word 'where'. It works very similar to the criteria property of a query.

DoCmd.OpenForm "formaname", , , "[criteriafield] = 'some criteria'"

You can always concatenate something into the where clause. For example, if you want to limit the form you're opening to the current record of the form you're on use something like the following:

DoCmd.OpenForm "formname", , , "[primarykey] = " & Me.primarykey
 
You could also make a subform on the main form and hide it and unhide it with a command button
Mike Rohde
rohdem@marshallengines.com
 
This works alright once the record has been created but I fins it isn't picked up when creating new records.

i.e. entering a new record, press the button and it stays on autonumber even though a new record has been created for it. You can then move around the records, come back and it works fine...

I'm confused

hope this makes sense!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top