Default valus for subform

  • Thread starter Thread starter Bob Danehy
  • Start date Start date
B

Bob Danehy

When opening a form, I want to be prompted to enter
default values for 2 fields in a subform. These values
would be used as long as the form is open. I have not
found a way to do this. I am using Access 97. Can anyone
help me?
 
I am guessing you want different 'default values' each time you want to open
the form. Be careful how you refer to them, "Default values" usually refer
to a property setting for the control (or a field in a table) which is true
anytime the form or table is opened.

Anyway.
Declare variables as needed in the declaration section of the underlying
module.

Dim strSomeString as String

'Then OnOpen of the form, if the variable is empty ask for a value
'Otherwise set control to = the variable

Private Sub Form_Open(Cancel As Integer)
If strSomeString <> "" Then
strSomeString = InputBox("Please Enter A Value", , "Default Value")
Else
Me.TextBox = strSomeString
End If
End Sub



This is kinda off the top of my head, but should get you started
Tony
 
Back
Top