I'm new to using append queries.
I found this page MS Access Unbound Forms and VBA which talks about creating a continuous form unbound from the original recordset. I think this is part of what I need.
I have a continuous form with the source being "qry_BLT_Update". This is an append query based off the table "tblBlotter".
On the form, I have several unbound textboxes, comboboxes and an option group. I simply want to be able to insert the values someone entered into the unbound controls to write to "tblBlotter" using a save button "btnSave". Then refresh/requery the source of the form to verify the new addition into the table.
I have the following code based on the page above, but not sure how it works.
It says to add the below code to the form load, but I'm unsure this is actually what I want. I'm also unsure that these codes are complete.
Thanks in advance!
I found this page MS Access Unbound Forms and VBA which talks about creating a continuous form unbound from the original recordset. I think this is part of what I need.
I have a continuous form with the source being "qry_BLT_Update". This is an append query based off the table "tblBlotter".
On the form, I have several unbound textboxes, comboboxes and an option group. I simply want to be able to insert the values someone entered into the unbound controls to write to "tblBlotter" using a save button "btnSave". Then refresh/requery the source of the form to verify the new addition into the table.
I have the following code based on the page above, but not sure how it works.
Code:
Public Sub getRecords()
'Code for updating append query
'turn off warnings, delete then populate the local access table with the SQL data
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM tblBlotter"
DoCmd.OpenQuery "qry_BLT_Update", acViewNormal
DoCmd.SetWarnings True
'dynamically set the recordsource and controlsource to the Access table.
Me.RecordSource = "SELECT * FROM tblBlotter"
txtMe.ID.ControlSource = "ID"
txtEntryDate.ControlSource = "EntryDate"
txtEntryTime.ControlSource = "EntryTime"
cboBadgeNum.ControlSource = "BadgeNum"
cboLocation.ControlSource = "Location"
txtResponse.ControlSource = "Response"
opOType.ControlSource.Value = "OType"
End Sub
It says to add the below code to the form load, but I'm unsure this is actually what I want. I'm also unsure that these codes are complete.
Code:
Private Sub Form_Load()
'Code for updating append query
'Run Public Sub "getRecords()"
getRecords
End Sub