hello,
(its me again![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
i was wonderring how i could change the default value
of a text field in a table from VBA...
the text field is 5 char. long
and represents a fiscal year (ei: this year is 02/03)
so if i dont want the program to be absolete next year
i need to give the user a method of changing the default
date from a form
i already have a "year list" form made
that lists all the years the program uses...
i was wonderring if i could just make a check box or something like that, that would simply change the default
property in the table
i found some code that hints on how i could do this but i dont know how to use it...
here is some code i found on the internet
Function SetDefaultValueInTable( _ strTable As String, _ strColumnName As String)
_ As Boolean ' ' Example usage:
bRetVal=SetDefaultValueInTable("tblYourTableName","YourColumnName"
' Dim ThisDB
As Database
On Error Resume Next Set ThisDB = CurrentDb With
ThisDB.TableDefs(strTable).Fields(strColumnName) Err.Clear
.Properties("DefaultValue"
= 0 'If Err.Number = 3270 Then ' .Properties.Append
.CreateProperty("DefaultValue", dbInteger) ' .Properties.Refresh 'End If End With
Set ThisDB = Nothing
SetDefaultValueInTable = (Err = 0)
End Function
but i dont know how to use it
it doesn't make sence to me![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
isn't there just a tablename.fieldname.defaultvalue = something property i could set in VBA?
thank you in advance,
Eric
(its me again
i was wonderring how i could change the default value
of a text field in a table from VBA...
the text field is 5 char. long
and represents a fiscal year (ei: this year is 02/03)
so if i dont want the program to be absolete next year
i need to give the user a method of changing the default
date from a form
i already have a "year list" form made
that lists all the years the program uses...
i was wonderring if i could just make a check box or something like that, that would simply change the default
property in the table
i found some code that hints on how i could do this but i dont know how to use it...
here is some code i found on the internet
Function SetDefaultValueInTable( _ strTable As String, _ strColumnName As String)
_ As Boolean ' ' Example usage:
bRetVal=SetDefaultValueInTable("tblYourTableName","YourColumnName"
As Database
On Error Resume Next Set ThisDB = CurrentDb With
ThisDB.TableDefs(strTable).Fields(strColumnName) Err.Clear
.Properties("DefaultValue"
.CreateProperty("DefaultValue", dbInteger) ' .Properties.Refresh 'End If End With
Set ThisDB = Nothing
SetDefaultValueInTable = (Err = 0)
End Function
but i dont know how to use it
it doesn't make sence to me
isn't there just a tablename.fieldname.defaultvalue = something property i could set in VBA?
thank you in advance,
Eric