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

selecting from listbox (setfocus) and sub/adding to/from a table

Status
Not open for further replies.

shy216

Programmer
Jul 21, 2005
142
US
i have a dynamic forms. how do i make it so that
when user select from a list box, type amount, and click cmdbutton.
and then select another from another listbox on new form.
and click cmd button,
it'll subtract amount from first row selected from the list box and then add an amount to the row selected from the 2nd lst box?
making sense?
frmTransferFrom: user selects from listbox and types in the amount and click OK.
THEN frmTransferTo opens up carrying the same amount.
frmTransferTo: user selects from listbox and click OK.
now i need to make it so that the first selection is subtracted from that chosen row and add to the second selection. is that possible?
 
yes, it can be done, but it sounds like you might be making it more complicated than it needs to be. Can you put it in terms of data?

Like...

"I want to pick a product from the listbox, enter the amount to remove from inventory, and then add that value to a record representing a vendor order for that product."

That might get suggestions for a cleaner design.
 
Hi
You could use OpenArgs:
[tt]DoCmd.OpenForm "frmTransferTo", , , , , , Me!List0[/tt]
Where Me!List0 is the name of your listbox.

 
it's a budget monitoring database.
so user would open a form "FSource" to see the balance of a budget line. After choosing a budgetline from Fsource user will click cmdTransfer. "frmTransferFrom" will open carrying over the same budget line from "Fsource."
from the same budget line, lstBud will query the
revenue source within the budget line.
user will click from that list and type in the amount and click cmdTransferTo.
frmTransferTo will open and carry over the amount and the
same budgetline. now they will select from the lstBud2 and
click cmdOK. here is the problem. i need to set it so that
the amount is subtracted from the first revenue(selection from lstBud)and amount is added to the second revenue(selection from lstBud2). another problem here.
each person has different budget source. meaning i need to find and update the field which has the correct StaffID, Rev#, and Bud.
ie. tbl_Fsource
STAFFID | ABID | FUND # | BALANCE
john doe| CE | D3 | $5000

so i need to find that balance field by matching
staffID, ABID, Fund#, etc... how can i locate that row...
i know im not making that much sense...
 
Why can't you set some Module variables lime m_sBudgetID, m_sStaffID, m_sFundNumber and m_dBalance for those values as you go along and use them in your queries?

Place in Modules.bas

Dim m_sBudgetID AS String
Dim m_sStaffID As String
Dim m_sFundNumber As String
Dim m_dBalance as Double

Hope this helps.
 
oh, because the update needs to show as well as the new balance. and also the transfer amount needs to be shown when printing a report. and rockinhorse.. i have no idea what you're talking about >_< still learning...
 
Have you looked at the Customer Orders form in the NorthWind sample?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top