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

How do I set a value when I open a form

Status
Not open for further replies.

TripperTim

Technical User
May 23, 2004
6
US
I have a simple form that I am working on, and I would like to have one of the values be equal to True if the form is opened. This particular form is only opened by the user if this value is true, so I don't see a reason for them to click the box if they don't have to.

Is it a simple = command line in the event procedure or is it a default value setting for an option / check box, or something completely different?

FYI the Field name is TrolleyStuck and it is a true/false.

Thanks
 
Set the default value property value of the field on the form to whatever you like. Also, depending on your purposes you can use this function to test if a form is open.

Code:
Public Function IsLoaded(frmName)
' Determines if a form is loaded.
    
Const conFormDesign = 0
Dim intX As Integer
    
IsLoaded = False
    For intX = 0 To Forms.Count - 1
        If Forms(intX).FormName = frmName Then
            If Forms(intX).CurrentView <> conFormDesign Then
                IsLoaded = True
                Exit Function  '  Quit function once form has been found.
            End If
        End If
    Next

End Function


Remember, wherever you go...there you are.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top