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?
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,230
Office Version
  1. 365
Platform
  1. Windows
Why do you need this error message?

Are you exporting to Excel?
 
L

Legacy 3234

Guest
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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,230
Office Version
  1. 365
Platform
  1. Windows
Why are you exporting to Excel?

Is there something you can do there that you can't in Access?
 
L

Legacy 3234

Guest

ADVERTISEMENT

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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,230
Office Version
  1. 365
Platform
  1. Windows
What are these things?
 
L

Legacy 3234

Guest
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?
 
L

Legacy 3234

Guest
Thank you, Giacomo. I'm about to leave for the weekend but will check that out first thing Monday.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,329
Messages
5,600,996
Members
414,419
Latest member
JRDunya

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
Top