Reputation: 313
I'm using below code to make connection and execute the query but it not working properly it shows "Auomation error unspecified error" the code is :
On Error GoTo err
DoCmd.Hourglass (True)
'For Report file Name
Dim rs As New ADODB.Recordset
Dim strReportFileName As String
Dim rsReportFileName As New ADODB.Recordset
strReportFileName = ""
Set con = Application.CurrentProject.Connection
sSql = ""
sSql = "SELECT * from tblInputFile as input inner join tblAccountMst as actmaster on input.Account=actmaster.AccountAsPerBOI"
If rs.State = 1 Then rs.Close
rs.Open sSql, con, adOpenKeyset, adLockOptimistic **'on this line i get the error and it goes to catch block**
If rs.RecordCount > 0 Then
If FE.FolderExists(Application.CurrentProject.Path & "\Reports\") = False Then
FE.CreateFolder (Application.CurrentProject.Path & "\Reports\")
End If
err:
MsgBox "Error " & err.Description
DoCmd.Hourglass (False)
please help im beginner in Access VBA. thanks in advance
Upvotes: 1
Views: 1325