Hi,
We have a database which is linked to an Excel spreadsheet and two lists in SharePoint.
We use the spreadsheet to update existing contracts and append new ones to SharePoint.
We have build three queries and they work as intended, but the result from db.recordsaffected is always 0 after we have exequted the append query 'qry_ap_new_contract_to_powldata'.
What could be wrong?
We have a database which is linked to an Excel spreadsheet and two lists in SharePoint.
We use the spreadsheet to update existing contracts and append new ones to SharePoint.
We have build three queries and they work as intended, but the result from db.recordsaffected is always 0 after we have exequted the append query 'qry_ap_new_contract_to_powldata'.
What could be wrong?
Code:
Public sStatusMsg As String
Private Sub cmd_update_data_Click()
Dim db As DAO.Database
'Dim sstatusmsg As String
Dim strQry As String
sStatusMsg = Empty
DoCmd.Hourglass True
'Turns off the Access warning messages
DoCmd.SetWarnings False
Set db = CurrentDb
'Kør forespørgsel til tilføjelse af nye kontrakter i POWL data:
strAppendPowl = "qry_ap_new_contract_to_powldata"
db.Execute strAppendPowl
sStatusMsg = db.RecordsAffected & " kontrakter tilføjet"
Debug.Print db.RecordsAffected
Debug.Print sStatusMsg
Me![MyProgress].Value = "33%"
'MsgBox sStatusMsg, vbOKOnly + vbInformation, "Tilføjelse POWL data"
' Kør forespørgsel til opdatering af eksisterende POWL data
strUpdatePowl = "qry_up_existing_powldata"
db.Execute strUpdatePowl, dbFailOnError
sStatusMsg = sStatusMsg & Chr(10) & db.RecordsAffected & " kontrakter opdateret"
Me![MyProgress].Value = "66%"
'MsgBox sStatusMsg, vbOKOnly + vbInformation, "Opdatering POWL data"
' Kør forespørgsel til opdatering af opfølgningsliste
strUpdateOpfoelgning = "qry_up_powldata_in_opfoelgningsliste"
db.Execute strUpdateOpfoelgning, dbFailOnError
sStatusMsg = sStatusMsg & Chr(10) & db.RecordsAffected & " kontrakter har ændret stamdata"
Me![MyProgress].Value = "100%"
'MsgBox sStatusMsg, vbOKOnly + vbInformation, "Stamdataændring kontrakter"
DoCmd.Hourglass False
'Turns the Access warning messages back on
DoCmd.SetWarnings True
MsgBox sStatusMsg, vbOKOnly, "vba\ cmd_update_data_click"
End Sub