Unbound field on form to the report

Markvand

Registered User.
Local time
Today, 17:56
Joined
Jul 13, 2004
Messages
88
Hello,

It's probably something simple, but I can't figure it out.

I have a report based on a query, what I want to do is transfer the text entered in the form to report, I don't need to store it in a table I just want to print the report and forget about entered text.

Any help would be much appreciated
 
Enter [Forms]![NameOfMyForm]![NameOfTextbox] in the control source for the unbound text box on your report.
 
G'Day Rich,

I've tried with all the ways, still getting: Name?, it's doesn't recognize it.
The field I want to get the text from is on continous form, 2 fields are unbound and the rest is bound to a query. Maybe this is a problem.
 
Store the text in a public variable and pass it to the report using OpenArgs

DoCmd.OpenReport "Your Report", OpenArgs:=strWhateverYourStringIs

then set the text box = Me.OpenArgs
 
Almost there,

Public contract As String

...

contract = Me!subform.Form.Contract
' The text field is on the subform" - it works fine

DoCmd.OpenReport "Metrics", acViewPreview, OpenArgs:=contract
' It passes the argument - works fine again

On the report in the desired texfield I have: =Me.OpenArgs

and it doesn't work, #Name?

Any ideas?
 
Create a module called Public Variables and place the variable in there.
 
Thnx for fast reply,

Still nothing, once again it passes the value but it doesn't display it on the report
 
Try this:

In the "On Activate" event of your report:

Me.MyTextBox = MyPublicVariable

I don't believe that you can reference a public variable directly from the text box on the report.
 
Where on the continuous form are these two fields and what are they for?
 
Hi Rich,

The main form is used a search engine, user can enter or pick a set number and then can see alll the items included in this set on the subform (continous form).
These two fields corespond to quantity and contract, as I wrote before these values don't have to be stored in a table. They can be entered, user can print the report and that's it.

I'm trying the Rich0 way, but for now I'm getting: "Action OpenReport was canceled", but I'll play around with a bit.
 
Now when you pointed that out, I will actually need just one, the other I have to store somewhere.
 
Another way....

mwn1218 said:
Store the text in a public variable and pass it to the report using OpenArgs

DoCmd.OpenReport "Your Report", OpenArgs:=strWhateverYourStringIs

then set the text box = Me.OpenArgs

It could also be done this way...

Instead of using a Text box control, use a label, set the caption using the Me.Label4.Caption = "" & Me.OpenArgs & ""
Or Me.Label4.Caption = "" & Forms!FormName!TextBoxName & "" as long as the original form is still open.

If IsNull(Me.OpenArgs) Then
MsgBox ("No data has been passed to this report, the BarCode can't be printed"), vbInformation
Exit Sub
Else
If IsNull(Me.OpenArgs) Then
Else
Me.Label4.Caption = "" & Me.OpenArgs & ""
Me.Label6.Caption = "" & Me.OpenArgs & ""
End If
End If
 

Users who are viewing this thread

Back
Top Bottom