Link to home
Start Free TrialLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

Limit Combobox to only 1 instance in the records

Experts,

I have this form with cboBankType.
The form is Continous Forms with underlying table : tblBanks_Participating
ID = BankEnterID

I want to limit a users input on this cboBankType to only 1 occurence of a "Initial Issuing Bank" (the ID is =1 on this BankType)...meaning that there can only be 1 "Initial Issuing Bank".

When creating records, How can I limit a duplicate entry on cboBankType for only when the cboBankType ID is =1 which corresponds to  "Initial Issuing Bank"? (this means that the previous record has this banktype description already)...

cboBankType [BankType field name] has this as a row source:
SELECT tblBankType_dropbox.BankTypeID, tblBankType_dropbox.BankType FROM tblBankType_dropbox ORDER BY tblBankType_dropbox.BankTypeID;

Please ask if you have questions.  I am thinking that possibly there is some type of Validation rule you can setup or something pretty simple to limit to only one "Iniital Issuing Bank".
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Ise the after update event of your combo box and the current event of your form for this, to change the combo's rowsource accordingly:


If DCount ("*", "YourTable", "BankTypeID = " & 1) > 0 then
     me.cboBankType.Rowsource = "SELECT tblBankType_dropbox.BankTypeID, tblBankType_dropbox.BankType FROM tblBankType_dropbox  WHERE BankTypeID <> 1 ORDER BY tblBankType_dropbox.BankTypeID"
End IF
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pdvsa

ASKER

Mbizup:  will try that....

Peter:  
<But first can you say what happens after the '1' - can all other values in the combo appear more than once, or are they also limited to a single occurrence.
Short answer:  yes...others are not limited...as many as want.
Avatar of pdvsa

ASKER

I think I will try a different approach and see how that goes.   thank you for the information.