• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • Last Modified:

Vb application on win98, winXP etc

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
zolpo
Asked:
zolpo
  • 3
  • 3
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
Arthur_WoodCommented:
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
 
zolpoAuthor Commented:
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
Independent Software Vendors: 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!

 
Éric MoreauSenior .Net ConsultantCommented:
Where is your connection (cn) declared and opened?
0
 
zolpoAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
before calling the Open method, add this:
cn.cursorlocation = aduseclient
0
 
zolpoAuthor Commented:
Hi emoreau!!!
THANKS A LOT!
it works.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now