Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change default value in backend table

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
I am trying to allow a user to change default values for a field in a backend table. The following code produces an error, can't append because the object already exists. Can what I want to do be done? Thanks for any help.

DBName = CurrentProject.Path & "\Datadb.mdb"
Set wrkDefault = DBEngine.Workspaces(0)
Set dbsUpdate = wrkDefault.OpenDatabase(DBName, True)
Set tdfUpdate = dbsUpdate.TableDefs("flkpTable1")
With tdfUpdate
Set tdfField = .Fields("DeclareT")
tdfField.Properties.Append tdfField.CreateProperty("Default Value", dbText, strDeclarant)

End With
Set wrkDefault = Nothing
 
If it already exists then
Code:
tdfField.Properties("Default Value").Value = strDeclarant
 
Thanks for the reply. I replaced my append statement with your suggestion. The code now runs through without error but when I check the backend table the default value is not set. It's completely empty.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top