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

Updating data in a combo box

Status
Not open for further replies.

jedel

Programmer
Jan 11, 2003
430
AU
Hi all

I'm building a rostering database and I'm using combo boxes to select from a list of names for each task that requires rostering.

There are three columns visible in the combo box; the person's name, the date he was last rostered, and how many times he has been rostered.

What I would like to achieve is that when the person is select ed for the task in the event, the date he was last rostered updates to the date of the event, shown in another field and the qty of time he has been roster increase by 1.

I've been trying to open DAO recordsets, but I'm unsure as to how to specify the record I want to edit

Any help would be great

Cheers

Dean

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
how about using an update query?

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
How are ya jedel . . .

Post the row source of the combo (sql/query/table)!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Ian

Your idea worked. Thanks

TheAceman1

This is what I ended up doing. The recordsource ofr the combo box is a query, here's the SQL:
Code:
SELECT MembersTBL.Name, MembersTBL.preacher, MembersTBL.dateused, MembersTBL.usedQty, MembersTBL.Caveats
FROM MembersTBL
WHERE (((MembersTBL.preacher)=Yes))
ORDER BY MembersTBL.dateused DESC;




Heres the code in the AfterUpdate event:
Code:
Dim defin As String

defin = "UPDATE MembersTBL SET MembersTBL.dateused = [Forms]![frmSample]![AppointmentDate]," _
& " MembersTBL.usedQty = MembersTBL.usedQty + 1" _
& " WHERE (((MembersTBL.Name)=[Forms]![frmSample]![Who]));"
DoCmd.RunSQL defin

Thanks for your ideas, Happy to work on any improvements to the code.

Cheers

Dean


-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top