Need error message if query results in more than 65536 recs

L

Legacy 3234

Guest
I am pretty good at Excel VBA but not too well versed in Access vba.

I have a form. I set up a button on the form (using the wizard) to run a macro.

The first thing the macro does is run a make-table query.

If the query is going to paste more than 65536 records to the table, I need to display a message and exit sub. I've searched far & wide and have no idea where to begin. Can anyone offer some advice?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Why do you need this error message?

Are you exporting to Excel?
 
Upvote 0
Yes, the table is exported to Excel after it's created. If it's too many records the whole program crashes. I could leave the "you are about to paste xxx records to the table" message on but I can't depend on my users to know enough to stop if it's too many.
 
Upvote 0
Why are you exporting to Excel?

Is there something you can do there that you can't in Access?
 
Upvote 0
Perhaps whatever they're going to do with the data could be done in Access if they knew how, but people in my department/company (including me) don't know how to use Access to do the things we do in Excel.
 
Upvote 0
Is there anyone here willing to tell me if what I asked for help with is possible or not and, if it is, point me in the right direction on how to do it?
 
Upvote 0
Thank you, Giacomo. I'm about to leave for the weekend but will check that out first thing Monday.
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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