hardhitter06
Registered User.
- Local time
- Yesterday, 23:26
- Joined
- Dec 21, 2006
- Messages
- 600
Hi All,
Access '03.
I have an input form with 2 fields that I am requiring. The first field is a combobox where I select a Vendor (which is a lookup to another table) :
The second field is a Bound Object box which requires a file.
Here is the code for my Before Update for my input form. This code runs upon hitting the save button:
My problem is this:
When I don't select a Vendor from the combo list, but insert an image, the record saves. THIS IS WHAT I DON'T WANT.
When I select a Vendor but I don't insert an image, my code takes effect and says my Bound object field cannot be left empty. This is what I want.
So I'm just confused on why it isn't stopping me when I leave out a Vendor from that combobox list?? Does it have something to do with that type of object?
Any help would be great. Thank you!
Access '03.
I have an input form with 2 fields that I am requiring. The first field is a combobox where I select a Vendor (which is a lookup to another table) :
Code:
SELECT tblInputNewVendor.VendorNameID, tblInputNewVendor.VendorName, tblInputNewVendor.VendorFedID FROM tblInputNewVendor ORDER BY [VendorName], [VendorFedID];
The second field is a Bound Object box which requires a file.
Here is the code for my Before Update for my input form. This code runs upon hitting the save button:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Tag <> "skip" Then
If ctrl.ControlType = acComboBox Or acBoundObjectFrame Then
If IsNull(ctrl) Then
MsgBox ctrl.Name & " Cannot Be Left Empty!"
Cancel = True
ctrl.SetFocus
Exit Sub
End If
End If
End If
Next
MsgBox "Record Saved!"
End Sub
My problem is this:
When I don't select a Vendor from the combo list, but insert an image, the record saves. THIS IS WHAT I DON'T WANT.
When I select a Vendor but I don't insert an image, my code takes effect and says my Bound object field cannot be left empty. This is what I want.
So I'm just confused on why it isn't stopping me when I leave out a Vendor from that combobox list?? Does it have something to do with that type of object?
Any help would be great. Thank you!