PhilipEwen
06-13-2001, 11:25 AM
Problem solved....forget setting variables and pulling into unbound box.
Set the default value as the [Forms]![prev form]![customer id]. Then set the control source as customerid...it inserts it automatically
Matthew Snook
06-14-2001, 06:56 AM
Phillip:
This is interesting to me. More info please!
So you're saying to set the default value of your data entry form as the [Forms]![prev form]![customer id]? Is prev form the name of the form with the button that generates the action? I need to do something similar, so details would help.
Matt
PhilipEwen
06-14-2001, 07:27 AM
Matt,
Yes, basically. Prev form is the prvious form from which the customer id is taken from, then passed to.
PhilipEwen
06-14-2001, 08:18 AM
Basically the code is this...
Private Sub add_treatment_button_Click()
On Error GoTo Err_add_treatment_button_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stCustomerID
stCustomerID = Me![Customer_ID]
stDocName = "add_ColourCard_info"
stLinkCriteria = "[CustomerID]=" & Me![Customer_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Add New Record Command
DoCmd.GoToRecord , , acNewRec
'[CustomerID] = stCustomerID
Exit_add_treatment_button_Click:
Exit Sub
Err_add_treatment_button_Click:
MsgBox Err.Description
Resume Exit_add_treatment_button_Click
End Sub
This carried the customer ID to the next form, which then goes to a new blank record, but retains the customer ID for insertion.
A better way about this ( I think - who knows i'm on day 4 of Access ! )would be to make up a new form from unbound boxes, then add a save button that reads info from each unbound box and inserts it into the table in the relevant places.
Just a thought.
Matthew Snook
06-14-2001, 09:01 AM
Thanks, Phillip.
This is great stuff.