Define textbox in report from form textbox

ss6857

Registered User.
Local time
Today, 04:30
Joined
Jul 12, 2011
Messages
38
I am trying to make a user friendly interface where a lot of updating of reports occurs. I have a form where a user can choose a customer name (eg. John Doe), type in a date (eg. 1/1/2011), click the command button and what I want to happen is that a textbox in the report "John Doe" with update to "Effective: January 1, 2011. I am having trouble when I am trying to reference the text box in the report. Here is my code:

Dim Cname As String
Dim edate As Date

Me.Combo113.SetFocus
Cname = Me.Combo113.Text
Debug.Print Cname

Code:
edate = Format(Me.Text126, "mmmm dd"", ""yyyy")
Debug.Print edate
Debug.Print Cname
DoCmd.OpenReport "" & Cname & "", acViewDesign
[COLOR=red]Reports![/COLOR][COLOR=black]("[/COLOR] & Cname & ").Text71.Value = "Effective: " & edate
DoCmd.Close acReport, "" & Cname & "", acSaveYes

Combo113 and text126 is on the form, combo selects the customer and text126 is where the date is inputed. text71 is the unbound textbox in the customer report. I am getting trouble as the red and is giving me the error "Compile error: Type-declaration character does not match declared data type"
 
You're trying to display the report criteria? I go at it the other way; you're trying to push to the report, I pull it from the report. Typically I have a form where the user enters criteria, and on the report I'd have a textbox:

="Effective: " & Format(Forms!FormName.Text126, "mmmm dd"", ""yyyy")
 
That would work, yes and that is what I did have, however the date will be different for every customer. so the effective date for John is 1/1/2011 but Jane's is 6/1/2011.
 
But won't the user have gone back to the form and chosen another name and typed in another date?
 
If I make all the text boxes on all the reports ="Effective: " & Format(Forms!FormName.Text126, "mmmm dd"", ""yyyy") then ALL of them will have the same date. If I do it that way, it doesn't matter if they select John or Jane, the date will be the date is Text126 at the current time. And, when I exit out of form that does the updating, I want that date that to save. If I use the above formula, once I exit out of the form the text box shows #Type!

That's why I want to define the textbox with the date in it so it can be permanently saved to its respective report.
 
Well, you know your needs better than I do. Does this work?

Reports(Cname).Text71.Value = "Effective: " & edate
 
Is this trying to output a sort of Last Updated date for a particular Customer?
If so, wouldn't it be easier to add a datestamp field to one of the tables and pull it in?

Or a Last printed date for a particular Customer / Report?
Create a table with ReportName & CustomerId (CustomerName) & LatestRunDate and pull it in with a DLookup statement.
 

Users who are viewing this thread

Back
Top Bottom