Parameter input with no parameter set up

  • Thread starter gmazza via AccessMonster.com
  • Start date
G

gmazza via AccessMonster.com

Hi there,
I have a report that when it runs it asks for parameters and I don't know why.

On my report are 399 text boxes named text1 to text399
In the On open event of the report I do some things that decide whether they
all show up or not, and assign values to the textboxes.

I have determined the problem is from one statement and I have dimmed
ValueCount appropriately.

Me.Controls("text" & ValueCount).ControlSource = Nz(DLookup("Value" &
TotalCount, "Assessment", "WeekId = '" & [Forms]![patient]![txtWeek] & _
"' and PatientId = '" & GetActivePatient() & "' and DayId = '" & Day & "' and
ClinicalTrialId = '" & GetActiveStudy() & "'"))

I even broke it down further and got rid of the Lookup and just went:
Me.Controls("text" & ValueCount).ControlSource = 2

and it still promtped me for parameter input.
Keep in mind that if I comment out this line then the report runs, just with
wrong data, so this line is making it prompt for a parameter.

Do you know why this is happening? Can I change my statement with different
code so it doesn't come up with a parameter?
Your answers are appreciated, thanks!
 
J

John Spencer

If you are trying to set the value of the control then to set a control source
to 2 you would need to use an equals sign before the value

Me.Controls("text" & ValueCount).ControlSource = "=2"

Otherwise, Access is going to assume you have a control source NAMED 2

So IF the expression is returning a value you want to display you will need to
append an = sign at the beginning and perhaps some quote marks if the value

Me.Controls("text" & ValueCount).ControlSource = "=""" & YourExpression & """"


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
K

KARL DEWEY

I would suggest using the Documentor and out to Word. Then search of wording
of the parameter prompt.
 
G

gmazza via AccessMonster.com

Worked perfectly, I thank you John!!

John said:
If you are trying to set the value of the control then to set a control source
to 2 you would need to use an equals sign before the value

Me.Controls("text" & ValueCount).ControlSource = "=2"

Otherwise, Access is going to assume you have a control source NAMED 2

So IF the expression is returning a value you want to display you will need to
append an = sign at the beginning and perhaps some quote marks if the value

Me.Controls("text" & ValueCount).ControlSource = "=""" & YourExpression & """"

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Hi there,
I have a report that when it runs it asks for parameters and I don't know why.
[quoted text clipped - 21 lines]
code so it doesn't come up with a parameter?
Your answers are appreciated, thanks!
 

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