Solved

ODBC Runtime Error 3146

Posted on 2002-05-29
15
811 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:vbjohn
  • 6
  • 6
  • 2
  • +1
15 Comments
 
LVL 1

Expert Comment

by:toys032498
ID: 7043190


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
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7043480
be sure the date is in the yyyy/mm/dd format
0
 

Author Comment

by:vbjohn
ID: 7044358
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
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7044366
again, check the date format from the regional settings.
0
 

Author Comment

by:vbjohn
ID: 7044452
Have you had the same error message before and did that correct it?

0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7044506
yes. regional settings are pain!
0
 

Author Comment

by:vbjohn
ID: 7044564
I did change it on hers and it still gives me the error.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7044770
try to hardcode the date into your criteria:

strWhere = "(YTDAPHistory.DOCDATE > #2002/05/30#)"
0
 

Author Comment

by:vbjohn
ID: 7045058
Why hardcode it?  I am just curious.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7045072
just to test if it is the date or something else.
0
 

Author Comment

by:vbjohn
ID: 7045199
It still does not work at all.  I checked both of our settings and they all match.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7045210
are you able to run the report from this computer straigth from Access? Are the dates appearing differently then on other PCs?
0
 
LVL 1

Expert Comment

by:toys032498
ID: 7045853
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
 

Author Comment

by:vbjohn
ID: 7047070
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
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 7425857
Points refunded and moved to PAQ pr request. No solution available.

** Mindphaser - Community Support Moderator **
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now