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

how to insert data based off combo box selections.

Status
Not open for further replies.

frankyberry

Programmer
Mar 15, 2007
33
US
I am a newbie to Access and I'm using access '07.
I have form that is driven off this table.
tbl_salespeople
Code:
ID(autonumber)
Name(text)
April(number)
May(number)
June(number)
July(number)

The form has a listbox containing all Names and a listbox containing all 4 months(April-July). I also have a textbox that the user would enter a sales amount.
I would like to have this form update the selected month total for the selected user with the given amount.

Example:
If person A has already sold 100$ for April and I enter a 10 into the textbox and select April, the update statement should populate the field to 110.

I have a button and hoping to do this with onClick.

Is this possible?
I'm having a terrible time with this button code.


many thanks in advance!

 
You will need an update query along the lines of the following. Table/field/form/control names will need to be changed to match what you are using.

Dim strSQL As String
strSQL = "UPDATE Table1 SET Table1.April = [april]+[Forms]![Form1]![txtSold] WHERE (((Table1.ID)=[Forms]![Form1]![txtID]));"
DoCmd.RunSQL (strSQL)

Cheers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top