I
ielmrani via AccessMonster.com
Hi,
I have a subform (subform1) with several records. Each record in subform1
has a button next it. When I click on the button it show another form (form2)
that contains the clients info. it works fine but the problem I am having is
when I create a new record.
When I add a new record to the subform1 (I add just first name and last name)
and then I click on the button that opens form2 (I add address, phone etc).
I am able to add these info but when I exit form2 the data is no longer there
for the new record. I know the reason but I can't find a solution.
The preason is this: The link between these 2 forms is Autonumber. when I
create a new record in subform1 it creates an autonumber, and the same thing
in form2. Except form2's autonumber is alwyas 1 more than subform1. and
that's why the data is not linked.
How do I solve this
I hope this is not confusing. I also did some search in this forum but no
luck. Thanks
Here is the code behind form2:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "form2"
stLinkCriteria = "Autonumber=" & [AutoNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Thanks in advance
I have a subform (subform1) with several records. Each record in subform1
has a button next it. When I click on the button it show another form (form2)
that contains the clients info. it works fine but the problem I am having is
when I create a new record.
When I add a new record to the subform1 (I add just first name and last name)
and then I click on the button that opens form2 (I add address, phone etc).
I am able to add these info but when I exit form2 the data is no longer there
for the new record. I know the reason but I can't find a solution.
The preason is this: The link between these 2 forms is Autonumber. when I
create a new record in subform1 it creates an autonumber, and the same thing
in form2. Except form2's autonumber is alwyas 1 more than subform1. and
that's why the data is not linked.
How do I solve this
I hope this is not confusing. I also did some search in this forum but no
luck. Thanks
Here is the code behind form2:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "form2"
stLinkCriteria = "Autonumber=" & [AutoNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Thanks in advance