That's not the reason in fact John. The reason is as follows:
I am the one who designed the form, and the form is based on a query which
consists of 3 table:
1. Supplier Invoices
2.Supplier
3.Project
Well... don't DO that then.
Instead, use a Combo Box for the supplier, and a Combo Box for the project.
Base the Form on the Supplier Invoices table directly, not on a query. The
combo can display the supplier name while storing the unique supplier ID; if
you want to see other information about the supplier (address, for example) on
screen, include those fields in the combo's RowSource query and put textboxes
on the form with control sources like
=comboboxname.Column(n)
where n is the zero based index of the field you want to see.
The user did not complete the form with the job number and when he saved it,
and opened it again he could not see the record because the link is inner
link. When I opened the table in fact there is the record which was not shown
because there must be 3 table involved in the query while there were only 2
You could change the INNER JOIN terms in the query to LEFT JOIN... but the
combo idea may well be preferable.
My question is how can we make it that job field in the form is a
requirement( compulsory) meaning that user can not save it unles they filled
the job number and supplier number, or we just make the table realtionship is
one to many but with outer joins
To make any field required, you can either make it a required field in the
table design, or use VBA code in the form's BeforeUpdate event to check.
Making the field required is good insurance but the error message may be
confusing to users. Form BeforeUpdate code might look like
Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
If Me!Supplier & "" = "" Then ' check to see if supplier is blank
iAns = MsgBox("Supplier must be specified; click OK to enter supplier," _
& " Cancel to erase form and start over:", vbOKCancel)
Cancel = True ' cancel the update
If iAns = vbCancel Then
Me.Undo ' erase the form if the user selected Cancel
End If
End If
<similar code for Project>
John W. Vinson [MVP]