ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use Excel to update Access tables (https://www.excelbanter.com/excel-programming/391221-re-use-excel-update-access-tables.html)

vqthomf

Use Excel to update Access tables
 
Hi Angus
I use an sql string something like this by sending the record number from
column A
HTH
Charles

Sub Deactivate(RcdID As Integer)
'
strSQL = "Select Active"
strSQL = strSQL & " From " & GetFromIniFile("QueriesTables", "Data",
strIniFile)
strSQL = strSQL & " Where id=" & RcdID & ";"

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
GetFromIniFile("dBPath", "dBBudget", strIniFile) & GetFromIniFile("dBNames",
"dBReviseBudget", strIniFile)
rst.Open strSQL, cnn, adOpenStatic, adLockOptimistic

On Error Resume Next
rst.Fields(0).Value = False
rst.Update
cnn.Close
Set rst = Nothing
Set cnn = Nothing
On Error GoTo 0


"Angus" wrote:

I got a query which extract data from Access table. Column A is a
auto-created key from Access table:

Column A Column B
123
124
125
126

How do I update data in column B and update the data in column B to Access
table, according to key in column A?

Thanks all.


Angus

Use Excel to update Access tables
 
hmmm...

I am not quite understand. Would you elaborate more...?

Should I add:

dim strSQL as string
....etc?

"vqthomf" wrote:

Hi Angus
I use an sql string something like this by sending the record number from
column A
HTH
Charles

Sub Deactivate(RcdID As Integer)
'
strSQL = "Select Active"
strSQL = strSQL & " From " & GetFromIniFile("QueriesTables", "Data",
strIniFile)
strSQL = strSQL & " Where id=" & RcdID & ";"

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
GetFromIniFile("dBPath", "dBBudget", strIniFile) & GetFromIniFile("dBNames",
"dBReviseBudget", strIniFile)
rst.Open strSQL, cnn, adOpenStatic, adLockOptimistic

On Error Resume Next
rst.Fields(0).Value = False
rst.Update
cnn.Close
Set rst = Nothing
Set cnn = Nothing
On Error GoTo 0


"Angus" wrote:

I got a query which extract data from Access table. Column A is a
auto-created key from Access table:

Column A Column B
123
124
125
126

How do I update data in column B and update the data in column B to Access
table, according to key in column A?

Thanks all.



All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com