Prevent a combo box from updating a table

avtuvy

Registered User.
Local time
Today, 11:41
Joined
Jan 10, 2010
Messages
39
My application includes a Combo Box which gets it's values from a query, when I close the form it inserts the value which is in the combo box into the table from which that data came from. How do I prevent the insert?
 
Delete the Control Source of the combo.
 
Thanks, works like a charm.
I am using a parameter from the same combo box as an input for a query but getting an error. The query which loads the combo box loads it with two columns and the ID which is used for the query is the second column, I guess I have a syntax error, please help
UPDATE dbo_DEVICES SET dbo_DEVICES.ID = Forms.frmDevices.Combo40.Column.[2];
 
Well, the column property is zero based, so the second column would be 1. You also want parentheses rather than square brackets (unless it also works with the square brackets; parentheses are the norm). That said, I don't think you can use the Column property directly in a query. Is the ID column not the bound column of the combo? If not, I believe you can wrap the form reference in the Eval() function to get it to work with the column property.
 
Any syntax other than what I put there results in a syntax error when I save the query so I assume that it is correct. You are are right about using the Eval() because when I run my form I am getting a popup which asks for the value for that parameter. How do I use Eval() do I need to write VB code?
 
No code. Untested off the top of my head:

UPDATE dbo_DEVICES SET dbo_DEVICES.ID = Eval('Forms.frmDevices.Combo40.Column.(1)')

You do realize that will update every record in the table?
 
Thank you for your help, I got it to work. I do realize that the way it was written it updates all the records, the code which I posted was just a test code for the combo box
The Syntax is:
Eval(" Forms.Devices.Combo40.Column(1)")
 

Users who are viewing this thread

Back
Top Bottom