Re: Is Not Null

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On my form I have two Date Fields and Two Combo Boxes. Once all the data
is
entered in the fields you click on a search button that runs the query.

according to your original post, above, you had code on a button "that runs
the query". i just gave you the code to check the search controls, and told
you where to insert the code you said you already have.

since the code you've now posted is using Select Case to open various
reports based on the value of what i assume is an option group control, i'm
not quite sure what you're doing. how about explaining how we jumped from
running a query to opening reports, and just where/when it is that you want
to check for null values in the controls you cited in your first post.

hth


"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F98D4ACA-09BD-44DE-B0DD-8A886DC52E6B@xxxxxxxxxxxxxxxx
Thanks - I can not figure out the last part, <put here the code to "run
the
query">

This is what I started with and then I added what you said to the bottom
of
my code which I am sure is wrong. I get an error message for the Else
statement.

When I click on my form's Command Button it first looks at an option group
then runs the query.

Private Sub Command13_Click()
On Error GoTo ErrorPreview

Select Case [fraPrint]

Case Is = 1
DoCmd.OpenReport "R-By_Date", acViewPreview
DoCmd.Maximize

Case Is = 2
DoCmd.OpenReport "R-By_Eval", acViewPreview
DoCmd.Maximize

Case Is = 3
DoCmd.OpenReport "R-By_W/C", acViewPreview
DoCmd.Maximize

' If you don't chose a default value, this generates a message box if the
user clicks a button without making a selection

Case Else
MsgBox "Select Report", vbExclamation, "Reports"


End Select

ExitPreview:
Exit Sub

ErrorPreview:
MsgBox Err.Description
Resume ExitPreview

Private Sub Command13_Click()
If IsNull(Me!cboStartDate) Or IsNull(Me!cboStopDate) Or
IsNull(Me!Combo
- Eval) Or IsNull(Me!Combo - Rating) Then
MsgBox "Data Required In Each Field."
Else
Command13_Click()
End If


End Sub



"tina" wrote:

try adding the following to the command button's procedure, as

If IsNull(Me!Date1) Or IsNull(Me!Date2) Or IsNull(Me!cboOne) _
Or IsNull(Me!cboTwo) Then
Msgbox "Enter a value in each field, please."
Else
<put here the code to "run the query">
End If

replace Date1, Date2, cboOne, and cboTwo with the correct names of the
controls, of course.

hth


"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FF3EFCA8-F07F-48D2-9FB8-C8B077FEAADE@xxxxxxxxxxxxxxxx
On my form I have two Date Fields and Two Combo Boxes. Once all the
data
is
entered in the fields you click on a search button that runs the
query.
All
that works as intended. What I want to add is a function that will
stop it
from running if one of the fields are blank. None of the fields are
connected
to a table so I can't use the "Required" function. I tried "Not Null"
in
the
Validation Rule - but that doesn't work either.

Any ideas ?

Thanks - George





.



Relevant Pages

  • Re: Code isnt subtracting.....it Should PLEASE HELP!!!
    ... Please post the SQL statement of the query you are using. ... >From your original post, you indicated adding two controls -- are you trying ... In which of the controls do the negative values appear? ...
    (microsoft.public.access.reports)
  • RE: Checking for null fields before running query
    ... I could use that sub and modify it so that it checks for Null in the ... return at least one record when all 3 controls have values. ... 3 cbo boxes, 2 buttons, 12 txt fields. ... the cboboxes provide parameters for a query, and also criteria for 12 DSum ...
    (microsoft.public.access.modulesdaovba)
  • Re: Check for Existing Else go to New
    ... query too. ... sfmProdOp controls are as follows: ... Private Sub SaveIfNew() ... Or IsNullThen Exit Sub ...
    (microsoft.public.access.formscoding)
  • Re: is there a non-data entry mode?
    ... The query I"m referring to is an Access query, ... Defines a variable called strFilter where you'll build an SQL filter ... The controls on the form displaying the data fields that you wish the ...
    (microsoft.public.access.forms)
  • Re: Need Help on Lookup Fields
    ... the Patient Care dBase. ... > Property to the name of this query (as long as the autolookup query has the ... When you create new controls, ... all you have to do when creating a new appointment is to ...
    (microsoft.public.access.forms)