microsoft+access+course - attaching msgboxmacro parameter
Request a callback

We'll call during UK business hours

Name:
Number:
0207 987 3777

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

resolvedResolved · Low Priority · Version Standard

Tue 24 Apr 2007, 17:39 replyReply Delegate 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

For upcoming training course dates see: Pricing & availability

Wed 25 Apr 2007, 12:12 Edited on Wed 25 Apr 2007, 12:12 replyReply Trainer 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

 

Access tip:

Deleting duplicate records from a table

You cannot delete records tables where there duplicate records. A way around this is to create a new table which wont hold the duplicates. and then deleting the old table.

1. Use a make-table query based on this table only. IMPORTANT - Ensure that you include all of the fields from your original table or you may loose data.

2. Open the query's property sheet by using VIEW, QUERY, PROPERTIES, and set the Unique Values property to Yes

3. Because you have selected the Unique Values to Yes when you run the query, Access creates a new table without duplicate records. You can now delete the old table and rename the new one.

View all Access hints and tips



MS Project training
Course rating:
4.8 stars - based on 5149 reviews
Microsoft Certified Partner Institute of Leadership and Management - Certified Courses Learning and Performance Institute - Accredited Training Provider Security Seal verified by visa, mastercard securecard

Connect with us: Facebook · Twitter · Google+ · LinkedIn · Pinterest