ODBC Runtime Error 3146

Here is my delema.  First I do not get this error on my computer.  Second, when my boss runs this application and the VB program tries to access the MSAccess Report she gets:

"Runtime Error '3146'
 Incorrect syntax near #170.."


What do you think I should do about this?


This is how I am accessing the MSAccess Report.


    Private appAccess As Access.Application
    Dim strWhere as String

    Set appAccess = New Access.Application
    strWhere = "(YTDAPHistory.DOCDATE > #" & txtEDate.Text & "#)"
    appAccess.Visible = False
    appAccess.OpenCurrentDatabase App.Path & "\VBMembers.mdb", True

    With appAccess.DoCmd
        .OpenReport "LCC-AP_Match", acViewPreview, , strWhere
        .Maximize
    End With
vbjohnAsked:
Who is Participating?
 
MindphaserCommented:
Points refunded and moved to PAQ pr request. No solution available.

** Mindphaser - Community Support Moderator **
0
 
toys032498Commented:


Remember that where your boss executes your program on her system may be located in a different file path then where you execute from.  App.Path can be your enemy if not used correctly.

appAccess.OpenCurrentDatabase App.Path & "\VBMembers.mdb", True

0
 
Éric MoreauSenior .Net ConsultantCommented:
be sure the date is in the yyyy/mm/dd format
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
vbjohnAuthor Commented:
But isn't App.Path "\" supposed to work on anything no matter where the application is at?


There is other employees that run this appilcation and it works for them and that is why this really puzzles me.  She wants me to fix it right away and I do not know how since it only has the error on her computer.



John-
0
 
Éric MoreauSenior .Net ConsultantCommented:
again, check the date format from the regional settings.
0
 
vbjohnAuthor Commented:
Have you had the same error message before and did that correct it?

0
 
Éric MoreauSenior .Net ConsultantCommented:
yes. regional settings are pain!
0
 
vbjohnAuthor Commented:
I did change it on hers and it still gives me the error.
0
 
Éric MoreauSenior .Net ConsultantCommented:
try to hardcode the date into your criteria:

strWhere = "(YTDAPHistory.DOCDATE > #2002/05/30#)"
0
 
vbjohnAuthor Commented:
Why hardcode it?  I am just curious.
0
 
Éric MoreauSenior .Net ConsultantCommented:
just to test if it is the date or something else.
0
 
vbjohnAuthor Commented:
It still does not work at all.  I checked both of our settings and they all match.
0
 
Éric MoreauSenior .Net ConsultantCommented:
are you able to run the report from this computer straigth from Access? Are the dates appearing differently then on other PCs?
0
 
toys032498Commented:
Things to check.

What version of MS Access is she running.
What vesion of vbrun time is she running (msvbvm60.dll).
Might even check for what version of MDAC she is running.  Just check the msado15.dll file to determine this.

I am also asuming that the access .mdb file is on here system, not on a network drive.

The point that I am looking at is that its a Syntax Error, meaning that there is something that is not correct in the way the code is written.

Sometimes different versions of classes support different parameter values when calling its methods or properties. This may be an issue as well.  Checking that all the files are the some on your system as well as hers will eliviate this question.


Also validate this value coming in.

If IsDate(txtEDate.Text) = True Then
     strWhere = "(YTDAPHistory.DOCDATE > #" & txtEDate.Text & "#)"
Else
     'Report Error to user
End If
0
 
vbjohnAuthor Commented:
It is on a network.  I think she is running both Access '97 and 2000.  I asked her just to use Access 2000 which I am using, but she needs both of them since a couple programs need them.  I will also check out the IsDate Function...


John-
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.