Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBList Rowsource problem 2

Status
Not open for further replies.

Rechmali

Programmer
Jun 14, 2004
17
GB
Hi, I wonder if someone might be able to give me a nudge in the right direction please.

I am trying to populate a dblist box using the following bit of code :
Code:
Set ScriptRS = objcomm.Execute("get_PrescriptionDetailsListBox", pr_Parameter, adCmdStoredProc)
       
With dblScript
    
    Set .RowSource = ScriptRS
        .ListField = "Script"
        .BoundColumn = "DetailID"
End With


Hoever when it gets to the Set .RowSource line, it fails saying:
Run-time error 91
Object variable or With block variable not set.


I don't understand what is going wrong as I have copied the code from another part of the same database which does work :(, only changing the ScriptRS name.

Data is being retrieved into the recordset, I have established that much!

Please help while I still have hair.

Cheers
Chris
 
Chris,
Step through your code stop it at the line after this one:
Code:
Set ScriptRS = objcomm.Execute(...)
Then, using the Watch window, inspect the ScriptRS variable. It might be that objcomm.Execute(...) is returning nothing.

JC

_________________________________________________
To get the best response to a question, read faq222-2244!
 
Thanks for your quick response.

It is returning a value.

If I put in another line of code after the set, I can see the info that I want...

Darn coding!
 
Chris,
How about dblScript? Is that properly initialized? There's really not much more we can look at. With the error: "Object variable or With block variable not set", you really don't have many choices. Inspect every single bit of code around that line and check what hasn't been initialized.

JC

_________________________________________________
To get the best response to a question, read faq222-2244!
 
have you tried simply
.RowSource = ScriptRS
rather than
Set .RowSource = ScriptRS
I don't think the set keyword is necessary for this control

Sam
 
Hi Guys,

Thank you both for your help.

Turns out that I had changed the component list and when I made sure I had the dblist with the yellow on the icon, I was able to make it work.

BIG LEARNING CURVE at the moment! :)

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top