B
Biz Enhancer
Hi All,
I have an issue with the deletion of a query.
The following code breaks at ** and returns Error 91 Object variable or With
block variable not set
Private Sub Form_Timer()
On Error GoTo Errtrp
Dim DBd As DAO.Database
Dim qdf As DAO.QueryDef
Dim Erm As String
Erm = "F329/Tim"
If DLookup("Round", "defaults") = -1 Then
strSQL = "SELECT rout1.ClientID, rout1.RentalID, rout1.AppID,
round(IIf(rout1.Revenuecycle=1,(([Rent]/30)*7),IIf(rout1.Revenuecycle=2,(([Rent]/30)*14),[Rent])))
AS RentA, rout1.Revenuecycle FROM (rout1 INNER JOIN Runit4 ON rout1.RentalID
= Runit4.RentalID) LEFT JOIN rout2 ON Runit4.RentalID = rout2.RentalID WHERE
(((rout2.RentalID) Is Null));"
DBd.QueryDefs.Delete "revcycl1" '**
Set qdf = DBd.CreateQueryDef("revcycl1", strSQL)
End if
Exittrp:
Exit Sub
Errtrp:
Call Ertbl(Err.Number, Err.Description, Erm, Me.Name, True)
GoTo Exittrp
End Sub
This has me completely baffled as the SQL select query returns good data,
the query "revcycl1" exists and has data in it prior to deletion, however
when the code tries to execute the deletion, the error occurs.
I have a similar routine that runs fine and deletes the query "revcycl1" on
cue without problem.
Most appreciative of any help.
Regards,
Nick.
I have an issue with the deletion of a query.
The following code breaks at ** and returns Error 91 Object variable or With
block variable not set
Private Sub Form_Timer()
On Error GoTo Errtrp
Dim DBd As DAO.Database
Dim qdf As DAO.QueryDef
Dim Erm As String
Erm = "F329/Tim"
If DLookup("Round", "defaults") = -1 Then
strSQL = "SELECT rout1.ClientID, rout1.RentalID, rout1.AppID,
round(IIf(rout1.Revenuecycle=1,(([Rent]/30)*7),IIf(rout1.Revenuecycle=2,(([Rent]/30)*14),[Rent])))
AS RentA, rout1.Revenuecycle FROM (rout1 INNER JOIN Runit4 ON rout1.RentalID
= Runit4.RentalID) LEFT JOIN rout2 ON Runit4.RentalID = rout2.RentalID WHERE
(((rout2.RentalID) Is Null));"
DBd.QueryDefs.Delete "revcycl1" '**
Set qdf = DBd.CreateQueryDef("revcycl1", strSQL)
End if
Exittrp:
Exit Sub
Errtrp:
Call Ertbl(Err.Number, Err.Description, Erm, Me.Name, True)
GoTo Exittrp
End Sub
This has me completely baffled as the SQL select query returns good data,
the query "revcycl1" exists and has data in it prior to deletion, however
when the code tries to execute the deletion, the error occurs.
I have a similar routine that runs fine and deletes the query "revcycl1" on
cue without problem.
Most appreciative of any help.
Regards,
Nick.