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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Default Field Value set to Public Variable

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
US
I would like to set field default value to that of a Public Variable.

I have a Public variable called DefaultAgency

I would like to set a table field default value to the current value of the variable.

Is this possible?

If IT ain’t working Binnit and Reboot
 
Hi!

I don't think you can. But, if the data will be entered using a form, then you can use the Current event to put the value of the global variable into the field whenver the user goes to a new record.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
You can set the default value for a field with
Code:
Dim cat As ADODB.Catalog
Set cat = New ADODB.Catalog
Set cat.ActiveConnection = <Some Connection Object>

cat.Tables("myTable").Fields("myField").Properties("Default") = Var
However that sets the field default to the current value of "Var". It would need to be executed again whenever the value of "Var" changes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top