Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me![cboActivityType]) Or IsNull(Me![cboTransActivity])
Or IsNull(Me![cboTransType]) Then
MsgBox "All fields are required...Thank you.", vbOKOnly,
"Incomplete Data"
Cancel = True
End If
End Sub
In any case, it might be better to open the table in design view and set the
Required property to Yes for all 3 fields. That doesn't require any code,
and works anywhere (not just in the form).
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")
"KathyB" <KathyB...@attbi.com> wrote in message
news:75e8d381.03060...@posting.google.com...
Just wondering...for now, I will change table fields!
thanks again.
Private Sub Hours_AfterUpdate()
[Forms]![frmTimeRecord].Refresh
[Forms]![frmTimeRecord]![frmTimeCardHours2].SetFocus
DoCmd.GoToRecord , , acLast
Me![Comment].SetFocus
End Sub
KathyBurke
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I just changed the 3 table fields to Required = Yes and it had no effect
on my form entry...it let me skip the fields and go on to the next
record!
I'm simply using a form/subform combination (with parent/child
relationship on an ID field). The subform source is the actual table.
Any clues appreciated...I've never seen this happen before.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")
"Kathy Burke" <anon...@devdex.com> wrote in message
news:3ede414d$0$204$7586...@news.frii.net...
If these are Access tables, JET won't let you save the record if one of the
required fields is not supplied.
If the tables are attached from another mdb, you need to set the fields'
Required property in the back end.
It is just remotely possible that you have a corruption here, but I doubt
that's it. Tools | Database Utilities | Compact and Repair. Make sure you do
that in the back end if the tables are attached.
You could add a Debug.Print statement to the top of your Form_BeforeUpdate
event to indicate if the event is firing at all. However, my guess is that
some other factor is at play here: it is extremely unlikely that you have
both a corrupted set of tables and a corrupted module for your form.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")
"Kathy Burke" <anon...@devdex.com> wrote in message
news:3ede45fe$0$199$7586...@news.frii.net...
I ended up going back to using a BeforeUpdate event on the subform, but
broke up the IF statement into separate checks of each field, if the
field is null, it then gives a msgbox and does an Exit Sub to force the
user to complete the field, next attempt to leave the record continues
to examine each required field, etc. This works for some reason where
the combined IF statement did not. Maybe something to do with my requery
statements on some of the fields (all combo boxes)? Anyhow, found a way
around it, but will remain confused about the table fields required =
yes problem.
Thanks again for all your help, Allen.
Kathy