Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / June 2005



Tip: Looking for answers? Try searching our database.

Default Value In Access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
boaz - 30 Jun 2005 18:14 GMT
Hi,

I need to update all the default values of the fields in Access.
I don't know what fields have default value.  So, I open all the tables and
look throught all the fields.
Would you guys point me to a better way to do this please?
Thanks!

> There is no answer.
> There has not been an answer.
> There will not be an answer.
> That IS the answer!
> And I am screwed.
> Deadline was due yesterday.
>
> There is no point to life.
> THAT IS THE POINT.
> And we are screwed.
> We will run out of oil soon.
Douglas J. Steele - 01 Jul 2005 00:46 GMT
While I realize this is an ADO-focussed newsgroup, in my opinion DAO is the
way to go for this:

Sub DefaultValues()
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim fldCurr As DAO.Field

   Set dbCurr = CurrentDb()
   For Each tdfCurr In dbCurr.TableDefs
       For Each fldCurr In tdfCurr.Fields
           If Len(fldCurr.DefaultValue) > 0 Then
               Debug.Print tdfCurr.Name & "." & _
                  fldCurr.Name & " has default value " & _
                  fldCurr.DefaultValue
           End If
       Next fldCurr
   Next tdfCurr

End Sub

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hi,
>
[quoted text clipped - 15 lines]
>> And we are screwed.
>> We will run out of oil soon.
 
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



©2009 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.