How to ensure that data is entered in subforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Currently, users can save records without entering any data into the subform.
How can I check that data has not been entered in the subform, before
updating the record?
 
hi,
here is a little technique i use for that.
at the start of the sub...
If IsNull(Me!txtControlNbr) Then
MsgBox (" Enter a Control Number.")
Exit Sub
Else
If IsNull(Me!txtVendorName) Then
Msbbox(" Enter a vendor")
Me!txtVendorName.SetFocus
Exit Sub
Else
If IsNull(Me!txtBuyer) Then
Me!txtBuyer.SetFocus
Msgbox(" Enter a buyer.")
Exit Sub
End If
End If
end if
rest of main code goes here.

If my users don't enter a control number or a vendor or a
buyer, then they don't get to go any further because
unless they do, you have the code to exit the sub before
they get to the main code.
the above sniplit is from code i use and it works. you may
need to modify it some to fit your situation. it may not
work as is but maybe it will give you ideas.
good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top