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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Forms

Status
Not open for further replies.

mrpowell

Technical User
Jun 14, 2001
8
US
I feel stupid here. I set up this database but have not had to add anything to it for awhile. The database is for a Head Start child tracking. The main form is "ChildInfo". I have several command buttons at the bottom of the form that links to other tables. I want to add another one, but for the life of me I can't remember how I did the other ones.

In the ChildInfo table I have a field called ID, which is set to auto number.

On all my other command buttons, when I access them from the main form the data comes up with the child's name and DOB in the footer.

When I have tried to add another command button in to add the form "FamilyNeeds", it doesn't link the "ChildInfo" ID number and starts at ID=0. It will not let me add any other info and gives kme an error message.

I want to be able to call up the "FamilyNeeds" and link it to the current record of the "ChildInfo" form. Any suggestions?
 
Hi
Did you use the Command Button wizard when you were setting up the other buttons? If so the OnClick event code would look a bit like this:
Code:
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "ChildDetails"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

You could then add a line just above 'stDocName=', like this, if ChildID is numeric:
Code:
stLinkCriteria = "Code=" & Me!ChildID
or if ChildID is text
Code:
stLinkCriteria = "Code='" & Me!ChildID & "'"
This will open a form showing only the records relevant to the current Child. You can also use OpenArgs to jump to the relevant record, without limiting the number of records displayed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top