Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box and VB Coding

Status
Not open for further replies.

Rgsjr

Programmer
Dec 10, 2001
6
US
Hello,
I am currently in a project using MS Access 7.0 , here is the situation;

1. The main form I am working with is “frmAccountEntryMain”.

2. The account number is selected by combo box pulling from a secondary table not attached or related to the main table on which “frmAccountEntryMain” is based (number series from 00001-99999).

3. The Query the combo box is pulling from is “qryAccountList”*
*Criteria: List only those accounts that are classified as “No”.

4. The Table “tblAccountList” on which “qryAccountList” is based has two fields;
1. AccountID
2. Assigned**

**The idea was to have the Assigned field default be “No” and update to “Yes” after it was assigned. The person entering information on “frmAccountEntryMain” would choose an account number. When they added the next account number the previous number would not be available.

Q: After selecting an account number, what can I use to change the assigned field for this account number from “No” to “Yes”?

Any Help would be appreciated.
 
On the combo box's AFTER UPDATE event, try something like this:
Code:
Dim rs as recordset
set rs = currentDb.OpenRecordset("tblAccountList")
with RS
 .index = "PrimaryKey"
 .Seek "=", me!{Your-ComboBox-Name}
 .edit
 !Assigned = "YES"
 .Update
 .Close
end With

set rs = Nothing

Ex-JimAtTheFAA
78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top