Solved

Vb application on win98, winXP etc

Posted on 2003-11-02
7
429 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 69

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 69

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 69

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

757 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

22 Experts available now in Live!

Get 1:1 Help Now