Linking text boxes

Id Field.. You mean use ID field in the combo box? The tool number and serial numbers are different all across with some tools only having one or the other.
I copied the form as a report so that I would have an exactly the same template.
 
The ID field you are referring to in the OpenReport command. That ID field relates to the Record Source of the report.
 
I setup the ID Field so that I could assign a primary key to it to individualise the tools because there are two or three tools in the full database with the same serial number.
 
Is it the fact that the report cant recognise where to get the information? I tried making a query based on the form n then the report based on the query but it got messy and i didnt have enough experience to pull it off. I was using the Forms!FormName!Textbox.value reference. I dont know if the above is the correct expression but its off the top of my head!
 
Nope! I'm talking about the OpenReport command. Have a look at that again and re-read my post #40.
 
Im still not following you. Im sorry but im a real novice at this!
 
Alright, I will go through it again.

Here's the code:
Code:
DoCmd.OpenReport "Copy_of_Main_Form", acViewPreview, , "[COLOR=Red]ID[/COLOR] = '" &[COLOR=Red] [/COLOR]Me.[COLOR=Red][Tool No#][/COLOR] & "'"
ID should be [Tool No#] because that is the field we're setting criteria against. So left hand side must match the right hand side.

The left hand side is the field we're setting criteria against and the right hand side is the field (or control) where we are getting the criteria value from.

Makes sense?
 
Here is the code I used now for my db;
DoCmd.OpenReport "Copy of Main Form (Search By Tool Number)", acViewPreview, , "Tool No# = '" & Me.[Tool No#] & "'"

However I get a runtime error 3075, syntax error missing operator in query expression '(Tool No# = '856A3387G03')'.
The tool number changes with every tool i search. In other world if i tryn to open the report when im displaying tool 856A1111 the error is;
runtime error 3075, syntax error missing operator in query expression '(Tool No# = '856A1111')'.
Any ideas??
 
So... notice how Tool # on the right hand side is wrapped in square brackets? It has to be done on the left hand side because you have a SPACE and a HASH character (#) in your field name. See why you should avoid those?
 
Thanks so much!
Its working now. It tranfers the information in the text boxes but as i said before, I have images that change with records but it is not changing these with each record. The report is keeping the same image all the time! :( any ideas? Do i need to reference the image controls in some way?
 
Also it keeps asking me to enter a parameter for the manual ref. And when I press cancel I get an error message saying the open report has been cancelled and it wants to debug the code. How do I solve this incase someone does click the report preview button by accident? Sorry for being a pain but I have no clue. Most of what I did I pieced together from the internet and experimented untill it worked for me.
 
I figured out the cancel problem and enter parameter problem.. I just can make the images follow through!!any ideas?
 
Thanks so much!
Its working now. It tranfers the information in the text boxes but as i said before, I have images that change with records but it is not changing these with each record. The report is keeping the same image all the time! :( any ideas? Do i need to reference the image controls in some way?
You are using a form. You need to use a subreport in a subreport control. Not a form in a subreport control.

So create a report and change the Source object of that report to the report.
 
So create a report in wizard, based on the table the form is based on? then use the same code to open that report?
 
Correct! I hope you are talking about the subform at the bottom of the report?
 
If so, when I create the report, the text boxes fill with the correct data but I place an image control and link it to the textbox "image" in the report (this has the same file path as the form because they are linked now) and i put the following code in the on open event of the report;
Me![Image33].Picture = Me![Image]

However i get an error runtime error '13' type mismatch

Any ideas?
 
Correct! I hope you are talking about the subform at the bottom of the report?

I just created an entirely new report from scratch and changed the code to open that one! Which it does and all the info is correct as i said, its just the images i want to change also.. AS i said i can put code on the report but i cant put code on the after update part of the textbox that contains the filepath of the image in the report. Or am i goin about this all the wrong way.. the info uploads correctly, i just need the images to upload too den its as good as done!
 
I used the above code but changed the references relating tool no# to the image "image 33" but it says runtime error 438 object doesnt support this property or method.
 
sorry but do you have any ideas becuase im well stuck and my boss is lookin to have it finished!! sorry!!
 

Users who are viewing this thread

Back
Top Bottom