Default Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to set a field's default value in a form to the contents of another
field on another table.

Help
 
You can use the Form OnOpen event to set the default value

Private Sub Form_Open(Cancel As Integer)
Me.FieldName.DefaultValue = Dlookup("FieldName","TableName")
End Sub
 
Ok it almost works. It places the value into the default of the field. But I
get the #Name? error because it wants quotes around the value in the default
field.
 
Try

Me.FieldName.DefaultValue = """" & Dlookup("FieldName","TableName") & """"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top