troubleshooting Question

Run-Time error message 3146

Avatar of gotiva
gotiva asked on
Microsoft Access
6 Comments1 Solution664 ViewsLast Modified:
If I run following VBA code in MS Access to create temp table for smaller data range (jan-march) it works fine, but if I run it for the whole year (really large amount of data), I am getting message:
Run-Time error 3146
ODBC call failed

The VBA code is:

Public Function CreateTable1()
' Create temp table
Dim sSQL, StartDate, EndDate
StartDate = InputBox("Enter Pay Period Start date")
EndDate = InputBox("Enter Pay Period End date")

sSQL = "SELECT *  INTO tblTempAllocs"
sSQL = sSQL & " FROM  ValAllocs "
sSQL = sSQL & " Where (ValAllocs.PPEndDate) Between #" & StartDate & "# And #" & EndDate & "#"

CurrentDb.Execute sSQL
End Function

My question is why am I getting error message and what should I do to avoid it?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros