B
brinalynn
I am new to Access so please be gently on your
explanations I am trying to do the following:
I have 2 forms both forms information are coming from
separate tables. I have a button on frm1(customer
details) to open frm2(forms status) linked by custID. I
am able to show the information for the current record in
frm1 on frm2 as long as the custID already exist in the
table for frm2.
I am having problems when I add a new record on frm1. I
would like certain fields from frm1 to show on frm2. For
example on frm1 I want the custID, custName, custPhone
fields to populate on frm2 in the appropriate text
boxes/labels. After updating the information on frm2 I
would like for it save to the table for frm2.
1. How do I get the new data on frm1 to show on frm2 when
it is opened? I am not sure if to get this to work should
be in the code or was there something I was to do when I
built my query for this form?
- AND -
2. Do I need to add a button on frm2 to have the data
save to the table for frm2?
This is the code I have thus far. Right now frm2 will
open with information that already exists in frm2 table.
If the custID does not exist in frm2 it will open with
all fields blank.
Private Sub cmdfrm2_Click()
On Error GoTo Err_ cmdfrm2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm2"
stLinkCriteria = "[CustID]=" & "'" & Me![CustomerID]
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ cmdfrm2_Click:
Exit Sub
Err_ cmdfrm2_Click:
MsgBox Err.Description
Resume Exit_ cmdfrm2_Click
End Sub
Any Help would be greatly appreciated!!
explanations I am trying to do the following:
I have 2 forms both forms information are coming from
separate tables. I have a button on frm1(customer
details) to open frm2(forms status) linked by custID. I
am able to show the information for the current record in
frm1 on frm2 as long as the custID already exist in the
table for frm2.
I am having problems when I add a new record on frm1. I
would like certain fields from frm1 to show on frm2. For
example on frm1 I want the custID, custName, custPhone
fields to populate on frm2 in the appropriate text
boxes/labels. After updating the information on frm2 I
would like for it save to the table for frm2.
1. How do I get the new data on frm1 to show on frm2 when
it is opened? I am not sure if to get this to work should
be in the code or was there something I was to do when I
built my query for this form?
- AND -
2. Do I need to add a button on frm2 to have the data
save to the table for frm2?
This is the code I have thus far. Right now frm2 will
open with information that already exists in frm2 table.
If the custID does not exist in frm2 it will open with
all fields blank.
Private Sub cmdfrm2_Click()
On Error GoTo Err_ cmdfrm2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm2"
stLinkCriteria = "[CustID]=" & "'" & Me![CustomerID]
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ cmdfrm2_Click:
Exit Sub
Err_ cmdfrm2_Click:
MsgBox Err.Description
Resume Exit_ cmdfrm2_Click
End Sub
Any Help would be greatly appreciated!!