A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Prevent combo box from updating a table



 
 
Thread Tools Display Modes
  #1  
Old March 11th, 2010, 09:33 PM posted to microsoft.public.access.forms
avtuvy
external usenet poster
 
Posts: 2
Default Prevent combo box from updating a table

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?

  #2  
Old March 11th, 2010, 09:41 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Prevent combo box from updating a table

On Thu, 11 Mar 2010 20:33:28 GMT, "avtuvy" u58699@uwe wrote:

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?


If the purpose of the combo box is just to find a record, and you don't want
it to update anything when you make a selection, simply set its Control Source
property to blank. This makes it an "unbound" combo box, to use the proper
jargon.
--

John W. Vinson [MVP]
  #3  
Old March 11th, 2010, 09:43 PM posted to microsoft.public.access.forms
M Skabialka
external usenet poster
 
Posts: 570
Default Prevent combo box from updating a table

Your combo has the same Control Source name as the field it is being stored
in. Rename it to cboMyField instead of MyField, with nothing in the Control
Source

"avtuvy" u58699@uwe wrote in message news:a4dd4503b4845@uwe...
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?



  #4  
Old March 11th, 2010, 10:38 PM posted to microsoft.public.access.forms
avtuvy
external usenet poster
 
Posts: 2
Default Prevent combo box from updating a table

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];

John W. Vinson wrote:
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?


If the purpose of the combo box is just to find a record, and you don't want
it to update anything when you make a selection, simply set its Control Source
property to blank. This makes it an "unbound" combo box, to use the proper
jargon.


  #5  
Old March 11th, 2010, 11:08 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Prevent combo box from updating a table

On Thu, 11 Mar 2010 21:38:02 GMT, "avtuvy" u58699@uwe wrote:

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];


Do you really want to do this? As written this query will update *every single
record* in the table dbo_Devices, setting the ID field to whatever is in the
third column of the combo box. If it's really what I'd call an ID this will
fail, since a primary key ID must be unique within the table.

Please describe in words what you're trying to accomplish. Where is the data
in the combo coming from, and what are you trying to do to dbo_DEVICES?
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.