943,717 Members | Top Members by Rank

Ad:
Jul 5th, 2009
0

initial value

Expand Post »
what will be the initial value of the fields created in a new table(dao)?
how to change it?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
shiv0013 is offline Offline
27 posts
since Jul 2009
Jul 5th, 2009
0

Re: initial value

That all depends upon if you allow those fields to default to their default values or not. As for changing those default values lets see your table creation code...
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jul 5th, 2009
0

Re: initial value

Set login = OpenDatabase("database path")
Set newtable = login.CreateTableDef("table_name")
With newtable
.Fields.Append .CreateField("name", dbText, 30)
end with
now wat is the default initial value and how can i change it?
Reputation Points: 10
Solved Threads: 0
Light Poster
shiv0013 is offline Offline
27 posts
since Jul 2009
Jul 6th, 2009
0

Re: initial value

Okay, this example works with both 2.5/3.51 and 3.6...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim daoDb As DAO.Database
  2. Dim daoTd As DAO.TableDef
  3.  
  4. Set daoDb = DBEngine.CreateDatabase("C:\z\MyDB.mdb", dbLangGeneral, dbVersion30)
  5.  
  6. Set daoTd = daoDb.CreateTableDef("MyTable")
  7.  
  8. daoTd.Fields.Append daoTd.CreateField("iID", dbLong)
  9. daoTd.Fields("iID").Attributes = dbAutoIncrField
  10.  
  11. daoTd.Fields.Append daoTd.CreateField("vFName", dbText, 30)
  12. daoTd.Fields("vFName").AllowZeroLength = True
  13. daoTd.Fields("vFName").DefaultValue = "Enter First Name Here"
  14.  
  15. daoDb.TableDefs.Append daoTd
  16.  
  17. Set daoTd = Nothing
  18. daoDb.Close
  19. Set daoTd = Nothing


Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: can two ms sql table display information on one vb datagrid???
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Easy for you complicate for me





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC