Valery
Registered User.
- Local time
- Today, 15:08
- Joined
- Jun 22, 2013
- Messages
- 363
Hi everyone,
In my data entry Client form, named frmUnitUpd, I have a combo box with the following codes to list all reports in the database that begin with the letters COR.
Combo Box: cboReports
Row Source Type: Table/Query
Row Source:
As well, a command button, named cmdReports, with the following Event Procedure:
The above codes work fine. I am able to select a report from the combo box, then click on the command button and it opens in print preview.
Is there a way to enhance these codes so that the selected report is linked to the client record I am into? The link would be a field named: UnitNum, located in the table called tblOccupancy. It is a primary key and number field (not autonumber).
I am a newbie – if you decide to assist (bless your heart), please provide all coding not instructions or explanations on how to create the coding. I would have no idea how to do that. I got the above coding somewhere on the Web.
Thank you!
In my data entry Client form, named frmUnitUpd, I have a combo box with the following codes to list all reports in the database that begin with the letters COR.
Combo Box: cboReports
Row Source Type: Table/Query
Row Source:
Code:
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") And (Left$([Name],3)="COR") And (MSysObjects.Type)=-32764 ORDER BY MSysObjects.Name;
As well, a command button, named cmdReports, with the following Event Procedure:
Code:
Private Sub cmdReports_Click()
If Not IsNull(cboReports) And cboReports <> "" Then
DoCmd.OpenReport cboReports, acViewPreview ' use acNormal to print without preview
Else
MsgBox ("You Must First Select a Report To Print!")
cboReports.SetFocus
End If
cboReports = ""
End Sub
The above codes work fine. I am able to select a report from the combo box, then click on the command button and it opens in print preview.
Is there a way to enhance these codes so that the selected report is linked to the client record I am into? The link would be a field named: UnitNum, located in the table called tblOccupancy. It is a primary key and number field (not autonumber).
I am a newbie – if you decide to assist (bless your heart), please provide all coding not instructions or explanations on how to create the coding. I would have no idea how to do that. I got the above coding somewhere on the Web.
Thank you!
Last edited: