Link to home
Start Free TrialLog in
Avatar of Stephen Roesner
Stephen RoesnerFlag for United States of America

asked on

Losing the link between records

They open the main form and review / update their client record
Then if they have to edit or add a new contact for this client they click the “Client Contacts” Button
This grabs the account number from this form and uses it to link to the clients table
And brings up all the specific client contacts for that client - it will be multiple records.
So its a one to many relationship.

This is the code behind the “Client Contacts” Button nothing special...
Private Sub Command151_Click()
On Error GoTo Err_Command151_Click
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Client_Contacts"
    stLinkCriteria = "[Acct#]=" & "'" & Me![ACCOUNT #] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command151_Click:
    Exit Sub

Err_Command151_Click:
    MsgBox Err.Description
    Resume Exit_Command151_Click
   
End Sub


The Client Contacts form comes up and everything works great.
They wanted a stream lined form so I added the [acct#] [acct name] and [owner] to the header of the form
with the multiple records of info in the detail of the form

Form header you have
                      [acct#] [acct name] and [owner]
Form Detail you have
                          [Contact] [name]  [address] etc etc ...
                           Contact is a list box with a list of specific contact names (Exp Admin Manager etc etc)

The Issue:
When I go to add a new contact record at the bottom of the form
it erases the [acct#] [acct name] and [owner] at the top of the form in the drop down boxes
and it no longer has a link to the acct record
so if you add a contact it has no [acct#] [acct name] and [owner]
and therefore is a lost record
How can I fix it where – when you add a new contact it stays on the client with the [acct#] [acct name] and [owner]
and adds the new record to this client.

I wish I could send you examples of my forms but I cannot
Becasue we are under HIPPA and Medical
we are locked down from sending anything out
therefore I can only explain the situation
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

What does your "Client_Contacts" form look like (design view)?

Also, what is the recordsource for this form?
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial