Solved

ODBC Runtime Error 3146

Posted on 2002-05-29
15
821 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 70

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

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 70

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

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 70

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 70

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

679 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