![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
strsql is a valid string returning one record, periodically the following fails on the 'if...' statement with error\ * * * 3420 - Object invalid or no longer set. * * With Me * * * * .RecordSource = strSql * * * * If (Not (.RecordsetClone.EOF)) Then * * * * * * .RecordsetClone.MoveLast * * * * endif * * *end with what could cause this ? should I try assigning 'recordsetClone' to a dao.recordset ? |
#3
| |||
| |||
|
|
On Dec 13 2010, 3:02*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: strsql is a valid string returning one record, periodically the following fails on the 'if...' statement with error\ * * * 3420 - Object invalid or no longer set. * * With Me * * * * .RecordSource = strSql * * * * If (Not (.RecordsetClone.EOF)) Then * * * * * * .RecordsetClone.MoveLast * * * * endif * * *end with what could cause this ? should I try assigning 'recordsetClone' to a dao.recordset ? I added more diagnostics, logging the ERL when the problem occurs 10 * * Me.RecordSource = "SELECT * FROM qrySelectContact WHERE 1 = 2" * * DoEvents 20 * * strSql = "SELECT *" & _ * * * * * * *" *FROM qrySelectContact" & _ * * * * * * *" * *WHERE " & strSql & _ * * * * * * *" * * ORDER BY baanCustomer, baanSupplier,baanPostalId, baanDeliveryId" * * Me.RecordSource = strSql * * DoEvents 30 * * If (Not (Me.RecordsetClone.EOF)) Then 40 * * * * Me.RecordsetClone.MoveLast * * * * DoEvents 50 * * * * Me.RecordsetClone.MoveFirst * * * * DoEvents 60 * * End If 70 the log shows erl = 30, so it failed with this statement * * *Me.RecordSource = strSql yet the earlier statement * * *Me.RecordSource = "SELECT * FROM qrySelectContact WHERE 1 = 2" which returns no data doesn't fail I also logged 'strsql' and I just tried a query with its value, and it works fine, returning one row so why is 'me' no longer valid ? and if I loop this chunk of VBA 8295 times I get a different error * There isn't enough memory to perform this operation. Close unneeded programs and try the operation again so obviously something isn't being cleaned up, and since my function only references 'me', I don't know what I can do ? |
#4
| |||
| |||
|
|
strSql = "SELECT *" & _ " FROM qrySelectContact" & _ " WHERE " & strSql & _ " ORDER BY baanCustomer, baanSupplier, baanPostalId, |
#5
| |||
| |||
|
|
Roger wrote: * * strSql = "SELECT *" & _ * * * * * * *" *FROM qrySelectContact" & _ * * * * * * *" * *WHERE " & strSql & _ * * * * * * *" * * ORDER BY baanCustomer, baanSupplier, baanPostalId, Any idea what the value of strSQL is in your Where statement? |
#6
| |||
| |||
|
|
On Dec 13 2010, 3:02*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: strsql is a valid string returning one record, periodically the following fails on the 'if...' statement with error\ * * * 3420 - Object invalid or no longer set. * * With Me * * * * .RecordSource = strSql * * * * If (Not (.RecordsetClone.EOF)) Then * * * * * * .RecordsetClone.MoveLast * * * * endif * * *end with what could cause this ? should I try assigning 'recordsetClone' to a dao.recordset ? I added more diagnostics, logging the ERL when the problem occurs 10 * * Me.RecordSource = "SELECT * FROM qrySelectContact WHERE 1 = 2" * * DoEvents 20 * * strSql = "SELECT *" & _ * * * * * * *" *FROM qrySelectContact" & _ * * * * * * *" * *WHERE " & strSql & _ * * * * * * *" * * ORDER BY baanCustomer, baanSupplier,baanPostalId, baanDeliveryId" * * Me.RecordSource = strSql * * DoEvents 30 * * If (Not (Me.RecordsetClone.EOF)) Then 40 * * * * Me.RecordsetClone.MoveLast * * * * DoEvents 50 * * * * Me.RecordsetClone.MoveFirst * * * * DoEvents 60 * * End If 70 the log shows erl = 30, so it failed with this statement * * *Me.RecordSource = strSql yet the earlier statement * * *Me.RecordSource = "SELECT * FROM qrySelectContact WHERE 1 = 2" which returns no data doesn't fail I also logged 'strsql' and I just tried a query with its value, and it works fine, returning one row so why is 'me' no longer valid ? and if I loop this chunk of VBA 8295 times I get a different error * There isn't enough memory to perform this operation. Close unneeded programs and try the operation again so obviously something isn't being cleaned up, and since my function only references 'me', I don't know what I can do ? |
#7
| |||
| |||
|
|
On Jan 31, 11:51*am, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Roger wrote: * * strSql = "SELECT *" & _ * * * * * * *" *FROM qrySelectContact" & _ * * * * * * *" * *WHERE " & strSql & _ * * * * * * *" * * ORDER BY baanCustomer, baanSupplier, baanPostalId, Any idea what the value of strSQL is in your Where statement? Yes, it too is logged, and as indicated, when I use the contents of strsql as a query, it returns one record so I know that strsql is valid |
#8
| |||
| |||
|
|
On Jan 31, 11:51 am, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Roger wrote: strSql = "SELECT *" & _ " FROM qrySelectContact" & _ " WHERE " & strSql & _ " ORDER BY baanCustomer, baanSupplier, baanPostalId, Any idea what the value of strSQL is in your Where statement? Yes, it too is logged, and as indicated, when I use the contents of strsql as a query, it returns one record so I know that strsql is valid |
#9
| |||
| |||
|
|
On Jan 31, 9:10*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote: On Jan 31, 11:51*am, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Roger wrote: * * strSql = "SELECT *" & _ * * * * * * *" *FROM qrySelectContact" & _ * * * * * * *" * *WHERE " & strSql & _ * * * * * * *" * * ORDER BY baanCustomer, baanSupplier, baanPostalId, Any idea what the value of strSQL is in your Where statement? Yes, it too is logged, and as indicated, when I use the contents of strsql as a query, it returns one record so I know that strsql is valid Hi Roger, So, strSQL seems allright. But what does qrySelectContact in case of the problem. It is a query, isn't it? Imb. |
#10
| |||
| |||
|
|
Roger wrote: On Jan 31, 11:51 am, Salad <sa... (AT) oilandvinegar (DOT) com> wrote: Roger wrote: * *strSql = "SELECT *" & _ * * * * * * " *FROM qrySelectContact" & _ * * * * * * " * *WHERE " & strSql & _ * * * * * * " * * ORDER BY baanCustomer, baanSupplier, baanPostalId, Any idea what the value of strSQL is in your Where statement? Yes, it too is logged, and as indicated, when I use the contents of strsql as a query, it returns one record so I know that strsql is valid I don't know what a ERL is. *I don't have the interest to google it either. After your SQL assignment statement I'd do a * * * * Debug.Print strSQL Then I'd copy the line from the Immediate window and paste it into a new query and run it. *If it executes correctly then take a .44 to your computer and put it out of its misery.- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |