Having trouble. May be a format problem?? See code below
Private Sub AgentNo_AfterUpdate()
Me!AgentNo.Locked = True ' this works
' Me!AgentNo.DefaultValue = """454""" ' this
does not work
' Forms![Customer Order].AgentNo.DefaultValue = """454""" ' this does
not work
' Me.AgentNo.DefaultValue = Me.AgentNo ' this does
not work
' Me!AgentNo.DefaultValue = Me!AgentNo ' this
does not work
' Me.AgentNo.DefaultValue = """" & Me.AgentNo & """" ' this does
not work
End Sub
John Vinson said:
On Sun, 21 Aug 2005 16:32:02 -0700, "jsccorps"
When I save the existing record, I want to pass the first field, SalesRep, to
the new record. Currently, all the fields are blanked out in the next
record. It would save my data entry folk some time if the Sales Reps name
would pass on automatically to the next record.
You can set the DefaultValue property of the control in its
AfterUpdate event. I'd assume that you're using a Form with a Combo
Box to select the SalesRep from a table of sales reps, and that the
combo is named cboSalesRep (if the situation is different you can
adapt this suggestion or post back): open the form in design view,
view the Properties of cboSalesRep, click the ... by the AfterUpdate
property and select Code Builder. Edit the Sub and End Sub lines
Access gives you to:
Private Sub cboSalesRep_AfterUpdate()
Me!cboSalesRep.DefaultValue = """" & Me!cboSalesRep & """"
End Sub
The four quotes are a quick way to insert a " character into a string.
John W. Vinson[MVP]