Hi guys.

Good day.!

I just want to ask on how to retrieve a query result when i filter a field on one table that has a value base on relationship of other table.

example: table1(genderid(autonumber),gender(text)
table2(membername(text),gender(text)

The value of table2 gender is based on table 1 via relationship created in ms access.

when i quey something like:

rs.open "select & from table2 where gender='" & cbgender.text & "'",conn,adopenkeyset,adlockoptimistic,adcmdtext

msgbox rs.recordcount

where cbgender.text =depending on user selection(Male, Female)

I just wonder whats missing right here because the recordcount is still 0 even if there is a match in a query.

Pls help

Thank you for giving time..

God bless.

Recommended Answers

All 2 Replies

try this

#
rs.open "select * from table2 where gender='" & cbgender.list(cbgender.listindex) & "'",conn,adopenkeyset,adlockoptimistic,adcmdtext
#

this code should fire after selection of the combo box not before that

try this

#
rs.open "select * from table2 where gender='" & cbgender.list(cbgender.listindex) & "'",conn,adopenkeyset,adlockoptimistic,adcmdtext
#

this code should fire after selection of the combo box not before that

tnx.this problem was solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.