?
Solved

Change value in 2nd combo

Posted on 2003-03-19
6
Medium Priority
?
152 Views
Last Modified: 2011-09-20
hi all

i have to 2 combo's in my form both populated from database, but when a particular value is selected from combo1, values in combo2 should change corresponding to the value in combo1...

how do i achieve this...is it possible...??
at the moment its giving me 'Run-time error 3709' - 'Operation is not allowed on an object refrencing a closed or invalid connection'...

tia
MB
0
Comment
Question by:malharbarai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 150 total points
ID: 8172029
private sub combo1_click()
' clearing the second combo
  combo2.clear
' make the sql for retrieving the values from the database
   sql = "select value from table where id = " & combo1.text
' open the recordset
   rs.open connection,sql,adopendynamic,adlockreadonly
' filling the second combo
  while rs.eof = false
     combo2.additem rs.fields(0)
     rs.movenext
  wend
  rs.close
end sub
0
 
LVL 1

Expert Comment

by:sazhagianambi
ID: 8173124
Hi,

Normally.

'Run-time error 3709' - 'Operation is not allowed on an object refrencing a closed or invalid connection'...

This Error Occur When You Are Trying To Open a recodset Thru Inavlid Connection object. So Please Check Your Connection Object Status. Most Propably You closed the Connection Object Before Trying to Excute Sql statement. Plz Check it.

Nambi
0
 

Expert Comment

by:CleanupPing
ID: 8531948
Hi malharbarai,
This old question (QID 20557021) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:malharbarai
ID: 8538347
this is what i figured out as the solutions

connString = "select area.serno,area.area,city.serno from area,city where city.city='" & cityVal & "' and area.city_code=city.serno order by area.area"
changeAreaRs.Open connString, ADOConn, adOpenDynamic, adLockReadOnly

While Not changeAreaRs.EOF
    areaCombo.AddItem changeAreaRs("area").Value
    areaCombo.ItemData(areaCombo.NewIndex) = changeAreaRs("area.serno").Value
    changeAreaRs.MoveNext
Wend

changeAreaRs.Close

the solution is much like wat DHAEST suggested, so I would surely like to award him those points

thnx
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 8538452
Thanks.
I'm glad that the problem is solved now
0
 

Author Comment

by:malharbarai
ID: 8538498
Much close to my requirement.

Thnx indeed
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question