I thought it had something to do with blanking the source, but I put it in that same with..endwith. BEFORE the SQL, eh? I'll try that.
Thanks,
-Michelle
>Clean List.Rowsource (THISFORM.Dvllistbox1.rowsource="") before running SELECT_SQL, and add List.requery afterward.
>
>>I just tried something else. If I run the code twice, _without_ the other form, it gives me the same error.
>>
>>-Michelle
>>
>>
>>
>>>I have this code:
>>>
>>>
>>>SELECT Users
>>>lnUserKey = USERS.UserKey
>>>SELECT DISTINCT operations.copname, als.opkey, als.UserKey, operations.cdir, ;
>>> operations.lMandCnum ;
>>> FROM als INNER JOIN operations ON als.opkey = operations.opkey;
>>> INTO CURSOR ops ;
>>> WHERE als.UserKey = lnUserKey
>>>
>>>IF _TALLY > 0
>>> WITH THISFORM.Dvllistbox1
>>> .ENABLED = .T.
>>> .ROWSOURCE = "ops"
>>> .ROWSOURCETYPE = 2
>>> .COLUMNCOUNT = 4
>>> .COLUMNWIDTHS = '150,0,0,0'
>>> .COLUMNLINES = .F.
>>> .BOUNDCOLUMN = 2
>>> ENDWITH
>>>ENDIF
>>>
>>>
>>>
>>>The first time through it works fine. After it runs, the user has an option of pressing a button that calls up another modal form. When it comes back, it runs this code again because that other form might have changed the user access.
>>>
>>>When it comes back, something has happened to the "ops" cursor. I try to USE it first before re-running the SQL, and it gives the title error. If I don't do that, it runs the SQL and creates the cursor again, and I can browse it, but when it gets to assigning the lbox's rowsource, it gives the error again.
>>>
>>>Each of these forms has its own datasession and they're both modal.
>>>
>>>Any ideas?
>>>
>>>Thanks,
>>>
>>>-Michelle