Solved

ODBC Runtime Error 3146

Posted on 2002-05-29
15
812 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LINQ return type for nested group query 6 74
change vba from autofit to 13.5 width? 4 28
message box in access 4 41
MsgBox 4 48
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 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

23 Experts available now in Live!

Get 1:1 Help Now