Solved

Vb application on win98, winXP etc

Posted on 2003-11-02
7
439 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
[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
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

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!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…
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…

705 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