morsoe
09-30-2013, 02:54 AM
Hi,
I have an Excel spreadsheet where I can click on a button. When I click the button a table is created in an Access database. How can I in the following vba code where the msgbox is shown count the records that are created in Access?
Sub GenopfriskMDM()
Dim AppAcc, AppAccDatabase
Set AppAcc = CreateObject("Access.Application")
'Set Database Path & Name
AppAccDatabase = "P:\KoncernOkonomi\indkobsafdelingen\ANALYSEAFDELINGEN\ACCESS\MDM Dublet tjek\test_MDM_data_c.accdb"
With AppAcc
'Open Database
.OpenCurrentDatabase AppAccDatabase
'Run Query
.DoCmd.OpenQuery ("q_tblUdtræk2")
End With
MsgBox "VBA \ MDM data genopfrisket"
End Sub
I have an Excel spreadsheet where I can click on a button. When I click the button a table is created in an Access database. How can I in the following vba code where the msgbox is shown count the records that are created in Access?
Sub GenopfriskMDM()
Dim AppAcc, AppAccDatabase
Set AppAcc = CreateObject("Access.Application")
'Set Database Path & Name
AppAccDatabase = "P:\KoncernOkonomi\indkobsafdelingen\ANALYSEAFDELINGEN\ACCESS\MDM Dublet tjek\test_MDM_data_c.accdb"
With AppAcc
'Open Database
.OpenCurrentDatabase AppAccDatabase
'Run Query
.DoCmd.OpenQuery ("q_tblUdtræk2")
End With
MsgBox "VBA \ MDM data genopfrisket"
End Sub