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

I created a form that allows users

Status
Not open for further replies.

KerryL

Technical User
May 7, 2001
545
US
I created a form that allows users to add or edit customer profile selections. (There are 6-8 descriptions within 4 different categories.)

On the form I have one combo-box and one text box. Users can select a category from the cbo, enter a description in the text box, then save the new entry into the table.

But I haven't been able to figure out how to make it impossible for a user to click on the save button and save blanks to the table. I want both fields to contain data before the save command button works. Can someone point me in the right direction?

Here are the object names:
frmEditCustProfile
cboCategory
txtDescription
cmdSave

Thanks in advance!
 
Kerry:

In the On_Click event of the save button test for a null in each control:

If isnull(cboCategory) Then
MsgBox "Some Message", vbOkOnly
cboCategory.SetFocus
Exit Sub
End If

Do the same for the text control. Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
Thanks Larry. I had already tested for nulls in each field by using an IF statment.

However, I forgot to exit the sub, so it was saving the data to the record anyway. (Duh!)

Thanks for your help,
Kerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top