Click here to Skip to main content
15,905,566 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please solve my problem

I use DBList in my project but it shows nothing in the DBList at when i run the program the code is below:

VB
'Code in view command

Private Sub cmdview_Click()

Set reccity = New ADODB.Recordset

reccity.Open "select * from city_detail where State_name='" & dc1.text & "'",Con,adOpenStatic,adLockOptimistic,adCmdText

Set dll.RowSource = reccity

dll.ListField = "City_Name"

dll.BoundColumn = "ID"

End Sub

'code in DBlist

Private Sub dll_Click()

reccity.Bookmark = dll.SelectedItem

txtid.Text = reccity.Fields(0)

dc1.Text = reccity.Fields(1)

txtcitynm.Text = reccity.Fields(2)

txtcitynm.Locked = False

End Sub


And after when i click on view button it shows the following error;

VB
Error :  Run-Time error '91':

Object Variable or With block variable not set
Posted
Comments
Prerak Patel 17-Aug-11 5:29am    
On which line does it give error? I doubt that there is some wrong code in form load.
Mudasar Ahmad 17-Aug-11 8:22am    
when i run the project and click on view button it shows the error which i already mentioned and after that i click on debug button it highlights the following line

Set dll.RowSource = reccity

1 solution

I doubt con is not set somehow. Debug more.
 
Share this answer
 
Comments
Mudasar Ahmad 17-Aug-11 8:24am    
i defined the variable 'Con' in module
Prerak Patel 17-Aug-11 23:51pm    
Not enough to know what causes the problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900