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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using list box to select corresponding records from table.

Status
Not open for further replies.

gtroiano

Technical User
Nov 7, 2001
99
US
Here's the rumpus:

Two Tables:

tblBudgetCode -
[p]BudgetCodeId
BudgetCode
BudgetCodeDescription

tblAccountInformation -
[p]AccountId
[f]BudgetCodeId
AccountNumber
AccountDescription

Each Account has a Budget Code assigned to it.

What i am trying to do is:
1. have a list box based on tblBudgetCode (i have this)
2. the user selects a budget code from the list box and
is showed, in a sub form, all the accounts that have
this budget code. (just so the user knows which accounts
are being affected)
3. then the user can click a button to delete the record
from tblbudgetcode or cancel.

the reason for all this nonsense is for table maintenance. occasionally, budget codes are changed or deleted all together. if anyone has a more practical way of doing this other then the mess i described above, i am all ears. thanks in adavance!

jerry.
 
you can simply put this code behind a delete button:


if you are in Access 97:

dbengine(0)(0).execute "Delete from tblbudgetcode where _
budgetcodeid=" & me.Listboxname.value

if you are in Access 2000:
Currentproject.connection.execute "Delete from tblbudgetcode where
budgetcodeid=" & me.Listboxname.value

'refresh listbox
me.listname.requery


any queries mail me at wonderhands77@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top