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

Help Me...

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
I have a report that calculates the sum of the a field which has three options (Pending, Closed, Open} These three options has a total. However some user forgot to select these options, meaning they left it blank. Therefore there is a discrepancy in the report. I want to create a textbox that would show those tickets that were left empty...How can I do that???? thanks
 
Someone may have a better solution but I would take a look at the IIF statment.

Be well
Trudye

 
I'm not sure that this will solve your problem, but couldn't you run a query that checks for null values for the field you're having people skip and return the report ID that has the blank field. To do this, I think all you have to do is type Is Null in the criteria section of your query for that field, then your next field of the query would be your report ID. Where you would put the results of this query would depend on where you wanted your textbox you mentioned. However, you should be able to associate the textbox with the query, possibly by typing the SQL statement for the query in the default value of your textbox. I'm not sure about that.

Something you might consider to prevent people from leaving fields blank is when the form is closed, check to make sure all desired fields are filled. I do this on several of my forms by doing the following:

I have a command button which closes the form. In the OnClick event I have several if...then...else statements that check to see if there are null values in fields that I want filled in. If there are null values, I display a message box saying to fill in those fields and set the focus back to the empty field. The VBA code looks something like this:

Private Sub Button1_OnClick
If Me![fieldname]="" Or IsNull(Me![fieldname]) Then
Msgbox "Please enter data in field.", vbexclamation, "Missing Info"
Me![fieldname].SetFocus
End If
End Sub

By putting this before my docmd.close statement, the above code is run first and does its check before my form is closed. If null values are found, the code is halted and the form remains open until all code is run and then my form is closed. I found this information on thread181-13675. Good luck!
 
medic133,

Thanks for you suggestion. I added some If and then statement to check the form before closing. It works great. Thanks again!!!![thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top