DLookUp Default Value

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

How do you DLookup the Default Value of a field in a table.

Me.TxtVal = DLookup("ChkMessage","tblChecks")

Thanks
DS
 
DS said:
How do you DLookup the Default Value of a field in a table.

Me.TxtVal = DLookup("ChkMessage","tblChecks")


You can't do it with DLookup, if I understand what you mean. DLookup can
return only values that actually exist in the table, not values that *might*
be added if someone adds a record without specifying a value for the field.

However, you can do it using DAO:

Me.TxtVal = _
CurrentDb.TableDefs("tblChecks").Fields("ChkMessage").DefaultValue

Bear in mind that the DefaultValue property is a string, and will be a
zero-length string if the field doesn't have a default value.
 
Back
Top