Reputation: 842
I have a form where a user inserts some values
When the user clicks the "ok" button Access makes a new table to save the values from disappearing when the form closes.
strSQL = "CREATE TABLE tblTempProjectGegevens (Project varchar(32),ProjectNummer varchar(32), Opdrachtgever varchar(32));"
DoCmd.RunSQL (strSQL)
strSQL = "INSERT INTO tblTempProjectGegevens (Project, ProjectNummer, Opdrachtgever)" & _
"VALUES ('" & ProjectInvoer.Value & "', '" & ProjectNrInvoer.Value & "', '" & OpdrachtgeverInvoer.Value & "');"
DoCmd.RunSQL (strSQL)
DoCmd.OpenForm "frmMain", acNormal, , , acFormAdd
DoCmd.Close acForm, "frmProjectInvoer", acSaveNo
I save these values in a table, because my program requires the form to be closed.
When the user is done using my access file, there are some reports to be printed. On these reports are headers in wich I want the values I have saved in the temp table.
How do I get the values from the table in my report headers? During a report_load() event?
Upvotes: 1
Views: 154
Reputation: 8402
Private Sub Report_Open(Cancel as Integer)
Dim db as Database
Dim rec as Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("tblTempProjectGegevens")
Me.Project.Value = rec("Project")
Etc...
End Sub
Upvotes: 1