ANY ADVICE please ! - SOLVED

PhilipEwen

Registered User.
Local time
Today, 01:44
Joined
Jun 11, 2001
Messages
81
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
 
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
 
Matt,
Yes, basically. Prev form is the prvious form from which the customer id is taken from, then passed to.
 
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.
 

Users who are viewing this thread

Back
Top Bottom