Use of Form to supply Parameter Query Args

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
I've got a form used primarily for 3 parameter inputs (1 text; 2 dates). I have a button thereon which Previews a Report based on the query being produced. The code under the Print-Preview button references an Embedded Macro to Open Report. Currently, I want to provide error-handling "IF" any one the 3 input fields is blank and or 2, or 3 fields ARE NOT Dates (as they should be). Should I, or better do I need to - change from the use of an Embedded Macro to Code for this? I see that in the Macro Window there is a provision for "On Error", but I do not understand how it works. If I went with code instead what would that code look like?

Thanks, Jim
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Jim, I personally prefer the VBA road. If I use a wizard to automate and it creates an embedded macro, I always use the conversion wizard to change it to VBA so that I have more flexibility. On the developer tab on the ribbon, the icon is on the far right. As to error-handling, it will work very similar to how you would do it in Excel. BTW, when you convert the macro, it automatically places some generic error handling.

Alan
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top