Can't assign a value to a report's Textbox

  • Thread starter Thread starter Richard Coutts
  • Start date Start date
R

Richard Coutts

MS Access 2000

I have a report with a Textbox that I would like to populate with a
record element of a table. The report is not referencing the table
(if that's the term) so the element is not available in the Record
Source pulldown.

When I create a textbox and put the line

=DLookUp("[Comment]","tblSchHeaderComments")

In the field, everything works great. The problem is that when I add
a search criterion, like

=DLookUp("[Comment]","tblSchHeaderComments", "[Jobs]=" &
Form_frmMain.cbxJob)

I get the popup dialog box "Enter Parameter Value: Form_frmMain"

As an attempted workaround, I put the line in my VB "Form Open" event
call

tbxHeader =DLookUp("[Comment]","tblSchHeaderComments", _
"[Jobs]=" & Form_frmMain.cbxJob)

But this gives me the error "You can't assign a value to this object.

If someone would clue me in, it would be much appreciated.

Thanks!
Rich
 
Hi,
When refering to a control on an open form, use the ! operator, not .
So...
Whoops...
just noticed you're using a reference to the form's module!!!

Don't do that.
The form MUST me open to grab a value from it.
If it's closed there are no values.

Anyway, here is the correct syntax:
Forms!frmMain!cbxJob

Keep in mind if this is a text value you have to delimit the criteria with single quotes.
 
Back
Top