view Msg if the form control is empty

rodich

Registered User.
Local time
Today, 12:10
Joined
Nov 24, 2009
Messages
20
Dear all,
I'm new here and in acccess 2007 too.

Sorry, that I will ask some foolishly .....

I have form with some controls (combo boxes, text boxes). The Form is not connected with table. When I fill them, then I use button to save it in table.

How I can to check that controls (one or more) is filled?


(in the moment I use Access 2007, and save database in 2000-2003 format)
 
I would suggest you put add some more VBA code to the code that runs when the button is clicked (before the “save” part of the code). Something like:

If Nz(Me.ctrl1, "") = "" Then
MsgBox "Ctrl1 box cannot be blank", vbOKOnly
Exit Sub
End If

If Nz(Me.ctrl2, "") = "" Then
MsgBox "Ctrl2 box cannot be blank", vbOKOnly
Exit Sub
End If

etc

hth
Chris
 
If Nz(Me.ctrl2, "") = "" Then
MsgBox "Ctrl2 box cannot be blank", vbOKOnly
Exit Sub
End If

Thank you, Cris!
I tried to use
"If [Forms]![EditAddTasks]![AddProblem] Is Null Then
MsgBox ("Please, enter some data about problem.") ......"
but is not waorking ....
Thank you again!
 
In Access VBA the correct syntax is not

[Forms]![EditAddTasks]![AddProblem] Is Null

but

IsNull([Forms]![EditAddTasks]![AddProblem])

and you don't really need the full reference to the control, this will do the same thing

IsNull(Me.AddProblem)

The Me takes the place of the current form name.
 
Thank you, missinglinq
I will take note about that!

Nave a nice day.
 

Users who are viewing this thread

Back
Top Bottom