[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Update an Access database

I'm trying to update an Access database using this code. It won't work! Any ideas?

VS2003

Dim strSQL As String
Dim MyConn As New Data.OleDb.OleDbConnection(gstr_ConnString)

strSQL = "Update tbl_aGlobalSettings Set FileName_DB, DefaultStation, zOriginDB_Versionz = " _
& "'" & Me.txtCurrentDBPath.Text & "'," _
& "'" & Me.txtDefaultStation.Text & "'," _
& "'" & Me.txtCurrentDBVersion.Text & "'" _
& " WHERE TracerID = 1"

Dim cmd As New OleDb.OleDbCommand(strSQL, MyConn)

MyConn.Open()
cmd.ExecuteNonQuery() ' It Fails HERE.....
MyConn.Close()


ADawn
0
ADawn
Asked:
ADawn
1 Solution
 
cubixSoftwareCommented:
Try

strSQL = "Update tbl_aGlobalSettings Set FileName_DB = '" & Me.txtCurrentDBPath.Text & "', " & _
                 "DefaultStation = '" & Me.txtDefaultStation.Text & "',"  & _
                 "zOriginDB_Versionz = '" & Me.txtCurrentDBVersion.Text & "' "  & _
                 " WHERE TracerID = 1"



The strSQL should end up like

Update tbl_aGlobalSettings Set FileName_DB = 'X', DefaultStation = 'Y', zOriginDB_Versionz = 'Z' WHERE TracerID = 1

HTH :)
0
 
sbarrow1Commented:
in the command window output the strSql and copy the line into Access as a query.  When you run it in access it will give you a better idea of the problem.

Stephen
0

Featured Post

Industry Leaders: 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!

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