Solved

ODBC Runtime Error 3146

Posted on 2002-05-29
15
823 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

729 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