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

Inserting into Not Null fields

Status
Not open for further replies.

sineados

Programmer
Oct 17, 2001
34
IE
Hi,

I have a table with some text fields with the Allow Zero Length = No. I am creating a sql statement to insert the record into the database.

The statement fails if some of the fields are not entered.Is there an easy way to check if the fields are null rather than having an 'if' statment for each control.

What I am actually doing is a copy so that if the user enters in a record and clicks on the copy button, all the information for that record will be copied in to a new record. Is there an easy way of doing this.

Thanks in advance,
Sinead
 
Is your user entering this information on a form? If so, then I would code it to check for null fields in your required fields before doing the copy.

For example:

On_Click()

If IsNull(me![field1]) then
msgbox "Field 1 is required"
exit sub
end if
If IsNull(me![field2] then
msgbox "field 2 is required"
exit sub
end if

docmd.openquery "copy query"


Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top