Stupid unwanted report parameter pop ups

  • Thread starter Thread starter Ryan_Thompson
  • Start date Start date
R

Ryan_Thompson

Guest
I have a report that is linked to a form by means of altering unbound text boxes by altering thei controls in the form. It allg oes according to plan, untill I close and reopen the report in the code so that information is saved, or leave the control altered as is and then try to print it; what happens is that for every unbound text box there is a pop up asking for the value of a specific text box, with the previous value as the caption. I sure as hell didn't put that code there so it must have something to do with the docmd. operator. In any case I'm at a loss here....... heres the code


Sub SetReportControls(varFieldName As Variant, conTextBox As Control)

'Check if selection is 'null'
If IsNull(varFieldName) Then 'Blank out the relevant objects
conTextBox.ControlSource = ""
Else 'Write the selected field name to the appropriate objects
conTextBox.ControlSource = varFieldName

End If
End Sub


and here is how it's opened:
DoCmd.OpenReport "Vertical", acDesign

and here is the code calling up the function above:
SetReportControls Forms![input form].VENDOR.Value, _
Reports!Vertical.VENDOR


vertical is the name of the report and vendor is a certain control on the report and form. Any help is awesome
 
I don't entirely understand the steps you are taking to get prompted for the values. I put together an 'input form' form and a 'vertical' report. The below code is behind my 'input form' form. The Command2 button is what the user clicks after selecting the field name from the VENDOR list - it alters the report, saves the alterations, and then previews the report for them.

Code:
Option Compare Database

Private Sub Command2_Click()

    DoCmd.OpenReport "Vertical", acDesign

    SetReportControls Forms![input form].VENDOR.Value, Reports!Vertical.VENDOR
    
    DoCmd.Close acReport, "Vertical", acSaveYes
    
    DoCmd.OpenReport "Vertical", acViewPreview
    
End Sub

Sub SetReportControls(varFieldName As Variant, conTextBox As Control)

    'Check if selection is 'null'
    If IsNull(varFieldName) Then 'Blank out the relevant objects
        conTextBox.ControlSource = ""
        Else 'Write the selected field name to the appropriate objects
        conTextBox.ControlSource = varFieldName
    
    End If
End Sub

I hope that you will see what I am doing differently; otherwise, you could try more clearly explaining the steps you take to get prompted for the value and I can again try to re-create the problem you are having.
 
That solution did not fix the problem unfortunately, it still prompted for parameter values, just at a slightly different time..... im at a loss for why it's doing this
 
Ryan,

When the report runs ... Is the form really open?

Wayne
 

Users who are viewing this thread

Back
Top Bottom