Forcing Data Entry into Form Fields to progress

Davrini

Registered User.
Local time
Today, 09:10
Joined
Aug 12, 2012
Messages
29
Hey guys!

I'm trying to create a form that forces the user to input data before they are allowed to do a variety of functions. Now, the most obvious way to do this is to control the Visible variable and I want to manipulate this function to achieve what I want to do.

My problem is that in order to start the whole process, I have two boxes - 'ScreeningDate' and 'ScreeningBy', and only once these boxes have been filled do I want the 'OptionFrame' to be shown. My problem is that at the moment, I'm not sure what the VBA code is so that only when both of those fields have data, can you see the 'OptionFrame'. I've tried IsNull, but that won't work :/

Any ideas on the solution to my pickle? Using Access 2010.

Thanks guys and gals!
 
You need code in the AfterUpdate events of BOTH controls. Normally fields are filled in tab order but unless you have taken control over the mouse, you can't actually be certain in which order the fields will be filled. When I need to use the same code more than once, I use a procedure and call it as needed.
Code:
Private Sub EditScreeingData()
    If Me.ScreeningDate & "" <> "" AND Me.ScreeningBy & "" <> "" Then
        Me.OptionFrame.Visible = True
    Else
        Me.OptionFrame.Visible = False
    End If
End Sub

Then in the AfterUpdeate event of each field -
Code:
    Call EditScreeningData()
 
With one slight tweak, that was exactly what I was after, thank you Pat!

(the tweak was that 'EditScreeingData()' was spelled incorrectly!)

Many many mucho thanks! My database is nearing the point where I am unable to see many additions or tweaks myself without someone else's input, which is exactly where I wanted it to be before it is presented to Management!
 
I forgot to mention that you probably will want to call this sub from the form's Current event also.
 

Users who are viewing this thread

Back
Top Bottom