Unanswered: Adding a new record with some criteria filled in and popup
Hi everyone. This should be easy. I’m just not as advanced as I’d like to be. I have an Access database that I use to track items for an auction. My table ITEMS tracks the auction items in addition to who won an item and the amount they paid for it and the ATTENDEES table tracks each registered guest. At checkout, I have a form that displays a person’s name and shows the total they owe and how they pay. There are buttons that can show the receipt and print the receipt.
I’d like to have a button that can add a generic item to the end of Items table with and ItemName of “Cash Donation” where you get a popup to fill in an amount which gets entered as the ItemFinal Price and assigns the AttNumber (attendee number who purchased it) to the same person whose information you were viewing on the checkout form.
In my Items table, ItemNumber is my primary key.
Private Sub Command59_Click()
Dim dbBoys_Girls_Club_2014 As DAO.Database
Dim rstItems As DAO.Recordset
Dim lngNextID As Long
Dim s As String
Set dbBoys_Girls_Club_2014 = CurrentDb
Set rstItems = dbBoys_Girls_Club_2014.OpenRecordset("Items")
lngNextID = DMax("[ItemNumber]", "Items") + 1
s = InputBox("Please enter the amount you'd like added", "Additional Donation", Default)
rstItems("ItemNumber").Value = lngNextID
rstItems("ItemName").Value = "Cash Donation"
rstItems("AttNumber").Value = AttNumber
rstItems("ItemFinalPrice").Value = s
On Error Resume Next