Hi,
I have a form with the following fields:
1st - Pick-list field of Status
2nd- Date Field named ApplyDate.
I would like to set the ApplyDate as mandatory if the Status= 'open'.
Also presenting a message to the user would be nice.
thanks,
J.
Hi,
I have a form with the following fields:
1st - Pick-list field of Status
2nd- Date Field named ApplyDate.
I would like to set the ApplyDate as mandatory if the Status= 'open'.
Also presenting a message to the user would be nice.
thanks,
J.
I had problems editing my own post, so I'll try again. I would use this technique:
http://www.baldyweb.com/BeforeUpdate.htm
You would simply add a test of the status field before testing the date.
I tried it but it's not working.
Any other way I can do it?
What exactly did you try? What exactly does "not working" mean?
I tried make is simple first and just enforce the date filled so it won't be empty.
I applied this code (after customizing it to my fields) on the BeforeUpdate of the form, as explained in the provided link.
If Len(Me.apply_date & vbNullString) = 0 Then
MsgBox "You need to fill out the date"
Cancel = True
Me.apply_date.SetFocus
End If
I don't get any message as should be and the form is updated when moving on to the next record.
How, exactly, shows as the Field Name in the Control Source Property of the 'Apply Date' Control?
Linq ;0)>
Is the code properly associated with the event?http://www.baldyweb.com/FirstVBA.htmHas anything been updated on the form at the point of the test? The update events only fire if there's something to be "updated".
The field name show as apply_date.
I put the code in the BeforeUpdate event of the form
I changed data on the form and still nothing.
I think the problem is deeper than that:
I created a new form and added a button with a simple OnClick event to present a message to the user.
Private Sub present_message_Click()
MsgBox "You need to fill out the date"
End Sub
This is not working at all - no message is presented.
Any ideas why?
Does any VBA code run? From you last post it sounds as if the answer is "No!" Code does not run in 2007/2010 unless your database resides in a folder that has been declared a “trusted” location.
To trust your folder, click:
- Office Button (top left)
- Access Options (bottom of dialog)
- Trust Center (left)
- Trust Center Settings (button)
- Trusted Locations (left)
- Add new location (button)
Here's a visual for it, courtesy of BTAB Development:
http://www.btabdevelopment.com/ts/de...aspx?PageId=13
If that doesn't do it, you might check to see if you have a Missing Reference to Windows Common Controls. I have seen a report of this causing this problem, when moving up from previous versions.
Linq ;0)>
Oh my god...
I even didn't know it should be like that.
Tested it and it is working just fine now.
Thank you all guys.
J.
Glad we could help!
Good luck with your project!
Linq ;0)>