By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,573 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,573 IT Pros & Developers. It's quick & easy.

Controling Report Controls Dynamically

P: 60
I have a report called rptFilter.
In my frmPrint Form, I have four option controls that allow for selection of specific criteria to contol what appears in the report. I also have two text boxes (txtHeader1, txtHeader2) that I want to use to change the header labels in the report (lblHeader1, lblHeader2).

When the user clicks the print button, this code runs:

Expand|Select|Wrap|Line Numbers
  1.     Select Case Me!fraWhere
  2.         Case 1
  3.             DoCmd.OpenReport "rptFilter", intDest
  4.         Case 2
  5.             DoCmd.OpenReport "rptFilter", intDest, , "txtName = '" _
  6.                 & cmbDept.Value & "'"
  7.         Case 3
  8.             DoCmd.OpenReport "rptfilter", intDest, , "numDOE = " _
  9.                 & Val(Forms!dlgEntry!dsubEntry!txtDOE)
  10.         Case 4
  11.             DoCmd.OpenReport "rptFilter", intDest, , "numDOE = " _
  12.                 & Val(Me!txtSpec)
  13.     End Select
I have tried this code to do what I want but it does not work:

Expand|Select|Wrap|Line Numbers
  1.             If txtHeaderOne.Value <> "" Then
  2.                 [Reports]![rptFilter].[Report]![lblHeader1].value = _
  3.                     txtHeader1.value
  4.             End If
I have also looked for a way to use the DoCmd.OpenReport openArgs arguement to sent the values to the report on open, but I cannot find any documentation or information on how to catch those values in the report once it opens (the rptFilter_Open() sub routine only has one argument passed to it, which is an Integer named Cancel)

Ultimately, what I would like to do is this:
if frmPrint.txtHeader1 has a value, set rptFilter.lblHeader1 = frmPrint.txtHeader1
Mar 16 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 1,356
If this is a label

Simply change the following:

To read:

if you would like to pass the value as an arguement.

Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
[Reports]![rptFilter].[lblHeader1].caption = Me.OpenArgs
Mar 16 '07 #2

P: 60
Thank you very much for taking the time to answer me. I think I prefer passing it as an argument. Have a good day

Mar 16 '07 #3

Expert 100+
P: 1,356
Glad I could help!
Mar 16 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.