Hi team,
I need your assistance in the below issue.
Requirement: I need to capture data in a database firstly code has to check if the specific database is already opened if database is opened then data has to be captured else it has to open the specific database and then capture the data.
Issue : Though code is working if I have some other database opened the code is looking for the table in the database which is already in open and shows error instead of opening the specific database. Could you assist.
I need your assistance in the below issue.
Requirement: I need to capture data in a database firstly code has to check if the specific database is already opened if database is opened then data has to be captured else it has to open the specific database and then capture the data.
Issue : Though code is working if I have some other database opened the code is looking for the table in the database which is already in open and shows error instead of opening the specific database. Could you assist.
Code:
Dim dB as dao.database
Dim rst as dao.recordset
Dim nwtsk as string
Dim dpth as string
Dim acapp as Object
dpth=“D:\dbtest\test_Database.mdb"”
On error resume next
Set accapp =getobject(“,access.application”)
Accapp.visible= true
If (accapp is nothing) then
Set accapp =new access.application
End if
With accapp
.opendatabase dpth
.visible = true
End with
Set dB= current dB
Set rst= dB.openrecordset(“tstdata”)
With rst
.addnew
!nwtsk = TEST1
End Sub