recordset problem?

neilwebber

Registered User.
Local time
Today, 17:50
Joined
Aug 19, 2002
Messages
35
Hello everyone,

I've had a good look round the forum and I'm sure the answer's already out there (most of them are) but can't quite find it. I'm guessing that this is fairly basic stuff but recordsets are new to me......

I have a query called qryA. The query has two fields, StringA and StringB.
I have a combo box called cmbA which is populated with values from StringA. Depending on the choice in the combo (cmbA.Value?) I would like to return the corresponding value in StringB and be able to refer to this value to perform other operations. This is as far as I've got from what I've found here already but without really grasping the basics I'm struggling a bit.

Dim MyValue As String

MyValue = CurrentDb.OpenRecordset("select StringB from qryA where [StringA] ='" & cmbA.Value & "';")

'then say....
MsgBox ("MyValue") to show the value from StringB

any words of wisdom are greatly appreciated, other than 'give up now!', I've already considered that :)
Cheers
Neil
 
Add StringB to your combo box row source, then refer to the second item as cmbA.Column(1)
 
Dave

Many thanks for a quick response and taking the trouble to provide an example db. Sometimes you spend so long looking at a problem that you start to make it much more complicated than it needs to be and it takes someone else to point out the blindingly obvious! Got it sorted now

cheers
Neil
 

Users who are viewing this thread

Back
Top Bottom