Reputation: 363
This is baffling me.
I have a userform with a listbox showing everything in my table (connected using rowsource)
On my form I have combo boxes and text boxes, when a user updates them I want the data to overwrite whats in the table.
When they click an account in the list box the text/combo boxes populate the data, when they change come data it simply does not save and I don't know why.
On the text/combo boxes I have the following code to save in the table:
RunCommand acCmdSaveRecord
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Refresh
Me.Dirty = False
Any idea why some wont save?
Upvotes: 0
Views: 2124
Reputation: 112
This is an alternative code to the one you have
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("SELECT * FROM <<Insert Table Name>> WHERE <<TextBox>>= Primary Key")
rec.Edit
rec("<<Table Field Name>>") = Me.<<Form textbox etc>>
rec("<<Table Field Name>>") = Me.<<Form textbox etc>>
rec.AddNew
Upvotes: 1