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

no current record?

Status
Not open for further replies.

Gustavson

Technical User
Nov 2, 2001
105
0
0
US
I'm using access 97.

I have a form on which the user enters information. This information is entered to a query via a add record button.

When users do not enter information into the building and chemical controls, I get a message when trying to view reports that says "no current record". So what I have to do is go into the query and delete those records with the missing information.

Is there a way to set up the form so that you cannot add a record unless certain controls on the form have been completed?
Another words, I do not want anyone to be able to add incomplete records...

Hope this is enough info...
Thanx
Gustavson
 
Solution:

In the table make the fields Required. Go into design view and Field Properties there is a field required and just say YES. It will not add the record if that field is null.

Thanx
Gustavson
 
Another more user friendly way is to add validation code to your button that saves the record. Before doing the Save, check for required fields.

This example tests for Null values but you can text for whatever you want.

If IsNull(Text0) Or IsNull(Text1) Then
MsgBox "These are required fields."
Else
'Save code would go here
DoCmd.Close
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top