matt beamish
Registered User.
- Local time
- Today, 19:44
- Joined
- Sep 21, 2000
- Messages
- 215
Have used a technique to insert records into an Access database from an Excel spreadsheet, using Insert SQL.
I need to get verification that records have been appended, but understand that Insert SQL does not support this.
Can I use DAO in the same function?
The Access database is referenced from the spreadsheet using a Public function
And within my function
When I am referencing the database remotely like this, can I also use
and then execute the SQL, and use a .RecordsAffected command?
Any help appreciated thanks.
I need to get verification that records have been appended, but understand that Insert SQL does not support this.
Can I use DAO in the same function?
The Access database is referenced from the spreadsheet using a Public function
Code:
Public appaccess As Access.Application
And within my function
Code:
Set appaccess = CreateObject("Access.Application")
appaccess.Visible = False
strSQL = "INSERT INTO [Weekly Staff Costs] ([Week_Ending],[StaffInit],[Job_No],[Hrs]) " & _
"VALUES (#" & Format(Range("B27"), "mm\/dd\/yyyy") & "#,'" & Range("D27") & "','" & Range("A29") & _
"'," & Range("C29") & ")"
With appaccess
.OpenCurrentDatabase ("C:\LocalData\mgb3\Projects\00000_Databases\financial\Databasetemp.accdb")
.DoCmd.RunSQL strSQL, dbFailOnError
.CloseCurrentDatabase
End With
Set appaccess = Nothing
When I am referencing the database remotely like this, can I also use
Code:
Dim db As DAO.Database
Set db = CurrentDb
and then execute the SQL, and use a .RecordsAffected command?
Any help appreciated thanks.