If statement (1 Viewer)

Angello Pimental

Registered User.
Local time
Today, 19:21
Joined
May 9, 2001
Messages
92
Could someone point me in the right direction concerning If statements.

I want to be able to assign a record a SortID# dependent on what value a user selects in a combobox.

For example, if a user selects:
Generic, the record is assigned SortID #1
UK, the record is assigned SortID #2
Japan, the record is assigned SortID #3

Does anyone know how I can do this using an If statment??

Thnx, Angelo


[This message has been edited by Angello Pimental (edited 06-15-2001).]
 

charityg

Registered User.
Local time
Today, 19:21
Joined
Apr 17, 2001
Messages
634
If I have more than two different "rules" I use a select case statement.

Afterupdate of cbo
select case cboName
case "Generic"
sortID=1
case "UK"
sortID=2
case "Japan"
sortID=3
end select

BUT...

If each row of your combobox is associated with a different SortID number, why not add a hidden column to the combobox that contains the sortID number and reference it that way?

Say the sortID column is the second column, you could reference by using cboName.column(1)

OR you could save the value back to the underlying table with

cboName_AfterUpdate
sortID=me!cboName.column(1)

Does this make sense? Or did I fly off on a tangent. Just trying to make things easier for you!!

Charity
 

Angello Pimental

Registered User.
Local time
Today, 19:21
Joined
May 9, 2001
Messages
92
Thankyou Charity,
Your suggestion worked perfectly!

Cheers,
Angelo
 

Users who are viewing this thread

Top Bottom