D DS Jul 31, 2008 #1 How do you DLookup the Default Value of a field in a table. Me.TxtVal = DLookup("ChkMessage","tblChecks") Thanks DS
How do you DLookup the Default Value of a field in a table. Me.TxtVal = DLookup("ChkMessage","tblChecks") Thanks DS
D Dirk Goldgar Jul 31, 2008 #2 DS said: How do you DLookup the Default Value of a field in a table. Me.TxtVal = DLookup("ChkMessage","tblChecks") Click to expand... 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.
DS said: How do you DLookup the Default Value of a field in a table. Me.TxtVal = DLookup("ChkMessage","tblChecks") Click to expand... 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.