Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / July 2008

Tip: Looking for answers? Try searching our database.

DLookUp Default Value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DS - 31 Jul 2008 19:37 GMT
How do you DLookup the Default Value of a field in a table.

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

Thanks
DS
Dirk Goldgar - 31 Jul 2008 20:18 GMT
> 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.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

DS - 31 Jul 2008 20:33 GMT
Works Perfectly!
Thanks
DS
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.