Matching

CodeCracker0291

Registered User.
Local time
Today, 15:42
Joined
Jan 19, 2002
Messages
33
I have a problem. I've made a form that holds information about a person and I have different buttons to take you to other forms to enter more info about the same person. Even though I made a table with all the info on it when I enter info first and then click the button to go to another form it will put the info in another table....Like...it's all on one table but the name will be on one level and the address will be on the one below it. Any help, I couldn't really give details b/c I'm in a rush so if i need to explain more I can. I've even tried putting an auto number(and relationships) ...but no luck. Thanks,
CodeCracker:confused:
 
Have you set the forms to open based on the unique number from the main for that the user enters data from?

Set a filter to run the forms where [PrimaryKey]=froms!formname![PrimaryKey] So the forms open on the same record!
 
Ok

Ok, I'll try this...But just in case...how exactly do you do this?
Thanks
 
I don't know exactly what your fields are...so I can't tell you exactly what to do. It just doesn't sound like have told the forms themselves to open on the same record.

Even though you have associated the tables with a promary key...unless you provide the promary key on both form and then tell it to open that same key....the records will appear different and eventually conflict with the UNIQUE property of the primary key.

Private Sub OpenSubForm_Click()
On Error GoTo Err_OpenSubForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "NameOfSubFrm"

stLinkCriteria = "[Frm2PrimaryKey]=" & Me![PrimaryKey]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenSubForm_Click:
Exit Sub

Err_OpenSubForm_Click:
MsgBox Err.Description
Resume Exit_OpenSubForm_Click

End Sub


So...you should be able to use this...in your OnClick() Event of the button that opens your subform.

Replace the "NameOfSubFrm"
Replace the "Frm2PrimaryKey" with your subform's Primarykey name
Replace the "PrimaryKey" with your matching Primary Key name from your Main Form
 

Users who are viewing this thread

Back
Top Bottom