How can we make a control in a form to a required field

  • Thread starter Frank Situmorang
  • Start date
F

Frank Situmorang

Hello,

My form is based on a query which consists of 3 tables:
1. Inovices
2.Supplier
3.Projects
There is a tendency save the record without filling in the supplier number
and when they want to update the record they can not see anymore the record.

Wht is the VBA in the controls/field of the form that supplier number and
project number are compulsory meaning they can not save the record if they
leave thses 2 fields missing

Thanks in advance
 
M

Maurice

Frank,

Don't go about this in VBA. Put the restrictions in the table design by
setting the field properties to required=yes

That way you don't have any maintenance and Access does the checking for you.

hth
 
A

Allen Browne

Open the related table in design view.
Select the foreign key field (Supplier).
In the lower pane, set Required to Yes.
Clear anything in the Default Value for the field (such as a zero.)

Repeat for Project field. Now Access will not allow any new records to be
saved if the Supplier or Project fields are left blank.

In general, it's best to use a main form and subform rather than try to
create records in 3 tables using one form.
 

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

Top