Reply

Join Date: Jul 2009
Posts: 5
Reputation: shiv0013 is an unknown quantity at this point 
Solved Threads: 0
shiv0013 shiv0013 is offline Offline
Newbie Poster

initial value

 
0
  #1
Jul 5th, 2009
what will be the initial value of the fields created in a new table(dao)?
how to change it?
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 776
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 137
vb5prgrmr vb5prgrmr is offline Offline
Master Poster

Re: initial value

 
0
  #2
Jul 5th, 2009
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...
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 5
Reputation: shiv0013 is an unknown quantity at this point 
Solved Threads: 0
shiv0013 shiv0013 is offline Offline
Newbie Poster

Re: initial value

 
0
  #3
Jul 5th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 776
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 137
vb5prgrmr vb5prgrmr is offline Offline
Master Poster

Re: initial value

 
0
  #4
Jul 6th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC