microsoft+access+course - attaching msgboxmacro parameter
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training add this page to your favourites/bookmarksBookmark page

view a printable version of this pagePrintable version
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access Training and help » microsoft+access+course - Attaching a msgbox/macro to a parameter

microsoft+access+course - Attaching a msgbox/macro to a parameter

The UK's most regular instructor-led training courses.
Training information: microsoft+access+course · Courses in microsoft access · Microsoft Access Training uk
See also · microsoft access training · access vba courses · access database course

resolvedResolved · Low Priority · Version Standard

No ranking yet
4 posts
replyReplyTue 24 Apr 2007, 17:39Delegate Shola said...

Attaching a msgbox/macro to a parameter

Is it possible to attach a msgbox to a parameter?

I have created a parameter in a query and the query is linked to a form. It is a date parameter. However it still aloows the user to enter an invalid date e.g. 31/04/07. I would like to attach a macro to the parameter to prevent the user from entering such invalid dates, using msgboxs and macro control-actions

Access Intermediate 1 day course
Version Date Location Places
available
Book Next place rate (£)
Pay by
Card
Pay by
Invoice
2003 Fri 12 Mar 2010 Bloomsbury 6 Book now £199 £204
2007 Tue 23 Mar 2010 Bloomsbury 3 Book now £224 £225
2003 Tue 30 Mar 2010 Bloomsbury 6 Book now £199 £204
2003 Thu 22 Apr 2010 Southwark 5 Book now £190 £195
2007 Tue 27 Apr 2010 Bloomsbury 5 Book now £224 £225
2003 Fri 28 May 2010 Bloomsbury 10 Book now £110 £115
Full Schedule: See all 21 Access Intermediate course dates.
Bookings currently available until 17th December 2010.

Platinum
635 posts
replyReplyWed 25 Apr 2007, 12:12 Edited on Wed 25 Apr 2007, 12:12Trainer Carlos said...

RE: Attaching a msgbox/macro to a parameter

Shola

To Verify the value of an entry before running the query do the following:

Create a form with a text box (For the date) And a Command Button

In the command button On Click command write code along these lines:

Private Sub cmdOK_Click()

If IsDate(txtDate.Value) = False Then

MsgBox "Please enter correct Date"
txtDate.SetFocus
Exit Sub
End If

DoCmd.OpenQuery "My Query"

End Sub

Then in the Query, in the criteria line for the date, use Build to set the query to look at txtDate on the form for the required value.

Regards

Carlos


Related articles

· Microsoft Access Training Opens Doors
· Tips for designing databases in Microsoft Access
· Interested In The Golden Rules For Building Access Databases?
· Data validation in MS Access
· How much time could you save with Access?

Access tip:

Zoom feature for queries

If youare working on on query design and creating a calculated field, it can be hard to view the whole statement. You can hold the shift key down and press F2, to show the zoomed up version of the query field

View all Access hints and tips


Rate this page:
2.1/5 (107 votes cast)
Institute of IT Training - Accredited Training Provider ILM
Microsoft Certified Partner
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider
McAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
Association of Computer Trainers verified by visa, mastercard securecard