Fields Require

vbnt

Registered User.
Local time
Today, 02:56
Joined
Sep 28, 2006
Messages
20
Attached program needs little code correction; but, I do not know how, Any help will be highly appreciated
The code attached works fine with fields Dentist , patient number and name, but when I try to apply the same code at fields productID and Quantity does not work because these fields at sub form , Can any one help me to handle this problem please ?

All what I need to in force user to fill all fields ( all fields require ) dentist, patient number, patient name, product Id and Quantity,

Regards
vbnt
 

Attachments

In table design change the "required" to "Yes" for whichever field you like

Col
 
Thanks a lot for reply ColinEssex

I did , but the problem still exist , code does not work right, you may need to down load the file and see.
Honestly, I need that help at ASAP, if you do not mind please?
 
Follow up my Q ?

Urgently, I need help and support to make that code works , anyone can help please ?
I am sure it is not difficult for expert people

Many thanks in advance
Vbnt
 
Because the product id and quantity fields are in a subform, you need to spell out the path from where the code is (main form) to where the control is (subform).

Thus,
Me.[Order Details Subform].Form.[ProductID]
instead of
Me.[ProductID]

Code:
ElseIf IsNull(Me.[Order Details Subform].Form.[ProductID]) Then
MsgBox "ProductID Require", vbOKOnly + 64, "ProductID"
DoCmd.CancelEvent
ProductID.SetFocus

ElseIf IsNull(Me.[Order Details Subform].Form.[Quantity]) Then
MsgBox "Quantity", vbOKOnly + 64, "Quantity"
DoCmd.CancelEvent
Quantity.SetFocus

You also had the Quantity control mislabelled in your code as 'Quantity Required'.

The square brackets around the 'Order Details Subform' are needed because you are using spaces in your subform control name. This is a bad practise to get into and I advise you to develop naming conventions that avoid using spaces or reserved words. (I'm a reformed non-conventionalist myself...believe me, it will save you more headaches than you ever want to know)
 
Hi CraigDolphin

This is the right answer I am looking for , it is really great. That makes me so happy.
Thank you so much, I really do appreciated.

Have a nice weekend

vbnt
 

Users who are viewing this thread

Back
Top Bottom