Default Value Question

  • Thread starter Thread starter Vinnie
  • Start date Start date
V

Vinnie

Hello all,

Is there a way (module or something), that will Set the Default Value of a
Certian Field to a Value I assign to it?

Specifics:
50 Forms in Database.
All Forms Have a Field [SeatNumber]. I would llike all the Forms to be
Static i.e: SeatNumber=5 (for all 50 Forms). Right now, I have to Open the
Control Properties for All 50 Forms to set the Default Value.

I cant set the Default Value in the Table itself, because it is linked and
there are 42 other database doing the same thing.

Any help would be appreciated as usual !

Vincent
 
Public Sub SetDefault()

Dim aob As AccessObject
Dim frm As Form
Dim ctl As Control

For Each aob In CurrentProject.AllForms
DoCmd.OpenForm aob.Name, acDesign, , , , acHidden
Set frm = Forms(aob.Name)
For Each ctl In frm.Controls
If ctl.Name = "txtTest" Then
ctl.Properties("DefaultValue") = "A Test"
Exit For
End If
Next ctl
DoCmd.Close acForm, aob.Name, acSaveYes
Next aob

End Sub
 
Back
Top