Prevent writing to the table

Philipc

New member
Local time
Today, 14:24
Joined
Aug 19, 2012
Messages
9
I am using Access 2010. How do I prevent the object typed into the textbox on a queryform being written to the table. The result from the name typed into the textbox on my query form correctly produces the result from the query, and my macros then produce the correct report, which I can either print or close due to the controls in the heading of the report. However, when I view the table, the name typed (only) has been inserted into the correct field as a new record in the table. Is there a macro I can add (I assume to an event in the query form) to prevent this happening?
Would be grateful for any assistance. Thanks.
 
sounds like you need to make the controls on your form where you are doing the typing unbound (i.e. the controlsource is blank)
 
Thanks for your quick response. Unfortunately if I use an unbound textbox my query which in one example has the parameter [Forms]![Owner Form]![Current Owner last name] does not work.
 
Thanks for your quick response. Unfortunately if I use an unbound textbox my query which in one example has the parameter [Forms]![Owner Form]![Current Owner last name] does not work.

This suggests the reference is to the Field in the RecordSource instead of the Control on the form. Access will default to a field if the control by that name is not found.

Check you are using the name of the unbound control.
 
Soory to be a duffer but I am still having a problem Can you give me the reference to be used as the parameter in the Query form if the unbound text box on the Queryform is called Text12.
I have tried various combinations and nothing works to bring up the name in the query.
I really appreaciate your help
 
Is the control being displayed in a subform?
 
No I have a form designed as a separate form with the textbox and a OK Button with macro for Set Value, OpenQuery and Open Report and also a Close Button
 
Forms!formname.controlname should work.

Forms!Queryform.Text12

What happens when you run the query?
 
Nearly there - found that I had typed Text12 (the label) instead of the control "Owner" Had to use the format [Forms]![Owner Form]![Owner] and that worked with the Query - and DID NOT add to the Table. One more little problem though - My OK button runs the Query and then opens the Report which used to work with the Bound Box. Now I am using the unbound box it is just showing a blank report. I was using the micro OpenReport and the name of the report.
I really appreciate all the effort you have put on on my berhalf. Many thanks
 

Users who are viewing this thread

Back
Top Bottom