Solved

Vb application on win98, winXP etc

Posted on 2003-11-02
7
438 Views
Last Modified: 2008-02-01
Hi,
I wrote a VB6 (MDAC 2.6, operating system win98) application that write data into access97 DB, I packeged it, installed it, and it works fine.
I tried to install it on a different computer (using access 2000),
 the installation was successful but when the application tries
to write to the DB I get the following error:
"Runtime error 2147467259 (8000 4005) operation must use
an updateable query"
On Windows XP I cant run it at all!
Could the problem be the differents versions of access, or operating systems?
How can I fix it???
thanx u all


0
Comment
Question by:zolpo
  • 3
  • 3
7 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 9666137
Show us your code. It seems that your connection is opened for read-only. Your problem is surely not Access but XP which installed MDAC 2.7. Some properties may have changed their default value.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9667054
it is most likely the different versions of Access that are involved.  But, s emoreau says, show us the code, and are you using ADO or DAO?

AW
0
 
LVL 1

Author Comment

by:zolpo
ID: 9670206
Hi,
Thank U!!!
I'm using ADO,
As to the problem with XP- on XP the program doesn't run at all, on Win98 with access 2000 the runtime error I mentioned before occurs.
I'm not sure the problem is that the connection is opened for read-only couse it works on Win98 with access97 (where I wrote the code).

Here is the code I use to insert into the DB:

Private Sub doLogin(name As String)
    Dim cmd As New ADODB.Command
    Dim strSql As String
    Dim sum As Currency
   
    today = Format(Now, "short date")
    hour = Format(Now, "long time")
    sum = Format(0, "currency")
     
     ' Define a query string
     'Inserting to big table
     strSql = "INSERT INTO entries (username,eDate,month_no,enter,exit,code,shift,occasion,cash,credit) VALUES ("
     strSql = strSql & "'" & name & "',#" & today & "#," & Format(Now, "m") & ",'" & hour & "','" & hour & "',"
     strSql = strSql & 1 & ",'" & shift & "','" & occasion & "', 0,0)"
       
    ' Set up the Command object
     cmd.CommandText = strSql
     cmd.CommandType = adCmdText
     cmd.ActiveConnection = cn
     cmd.Execute
    ' Tidy up
     Set cmd = Nothing
     
    'inserting into backup table
     strSql = "INSERT INTO quickEnter (username,eDate,eTime,code) VALUES ("
     strSql = strSql & "'" & name & "','" & today & "','" & hour & "','" & 1 & "')"
     
     
     cmd.CommandText = strSql
     cmd.CommandType = adCmdText
     cmd.ActiveConnection = cn
     cmd.Execute
    ' Tidy up
     Set cmd = Nothing
End Sub
Thanks again.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 9670308
Where is your connection (cn) declared and opened?
0
 
LVL 1

Author Comment

by:zolpo
ID: 9670468
Hi emoreau,
The connection is declared and opened in module.bas file:

Public cn As ADODB.Connection


Public Sub connectToDB()
    Dim DBpath As String
    Set cn = New ADODB.Connection
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    DBpath = App.Path & "\DB.mdb"
    strConn = strConn & DBpath
    'strConn = strConn & "d:\keren\ovdim\DB.mdb"
    cn.ConnectionString = strConn
    cn.Open
End Sub

The sub connectToDB is called from  a load form function
Thanx!
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 400 total points
ID: 9670555
before calling the Open method, add this:
cn.cursorlocation = aduseclient
0
 
LVL 1

Author Comment

by:zolpo
ID: 9671468
Hi emoreau!!!
THANKS A LOT!
it works.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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…
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…
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…
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…

730 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