I have a form, that I want to be able to press a command button and take the data from the form and populate a report with that data. How would I achieve such in access 2000?
I have a form, that I want to be able to press a command button and take the data from the form and populate a report with that data. How would I achieve such in access 2000?
To display the record:
http://www.baldyweb.com/wherecondition.htm
or if unbound you can have textboxes on the report refer to textboxes on the form.
I have added this to the OnClick() event handler of a command button I have added to my form -- however, it only shows #Name? for everything?
Code:Private Sub cmdbutton_Click() DoCmd.OpenReport "Report1", acPreview, , "userid = '" & txtuserid & "'" End Sub
Is userid defined as a Text Datatype, as your code suggests?
If it's defined as a Number Datatype, the syntax for the Where Condition would be
"userid = " & Me.txtuserid
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007
Does the report show data if you open it from the nav pane?
It's actually a linked SQL Server table that is defined as an autonumber (so yes an int). I altered to your syntax of
[code]"userid = " & Me.txtuserid{/code] but I get the same outcome of #Name?
Nav pane? -- I am wanting to only show the data from the userid that is being displayed on the form, so the form shows data, but the second I attempt to generate the report it does not.
Question - Should the text boxes on my report be bound or unbound? I have them bound to the corresponding SQL server fields, but if I am just transferring data from the access form, should they be unbound?
If you're using the method from my link, which gave the syntax for numeric data types, the assumption is that the report is bound to a table or query and textboxes to the appropriate fields in that table or query.
Ah, had a typo! Last question and I am all set. Is there a way to pass a value from the form to the report that is not stored in a database?
For example, pass the value from the form stored in txt123 to a field on the report called txt12
Like I said, refer to the form:
=Forms!FormName.TextboxName