Update table with a macro

R

R Whittet

Hello, I have a form that is used to enter specific electrical readings on
pumps. I have placed a button on my form to open a report to show these
readings for a specific pump based on which pump has been selected in the
combo box on my form. The idea behind this is so that the user can enter new
information, then view that information along with previous information
without having to re-select the specific pump from a new form. The problem I
am having is that when the button is clicked and the report is opened, the
new data that has been entered isn't appearing on the report. I am looking
for a method to update the table, through a macro, with the new information
entered without having to close the form or having to start a new record.
Thanks in advance!
 
R

R Whittet

I was able to solve this problem I was having by using visual basic. Posting
for future reference.

Private Sub Command28_Click()
On Error GoTo Err_Command28_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim stDocName As String

stDocName = "RS_Maint_Amperages2"
DoCmd.OpenReport stDocName, acPreview

Exit_Command28_Click:
Exit Sub

Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click

End Sub
 
S

Steve Schapel

Rick,

Add a RunCommand/SaveRecord action to your macro, before the OpenReport
action.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top