Nov 26 2011, 09:20 AM
I'm pretty new with Access. I want to make a form that updates its field based on the database that has been filled previously using combobox.
combobox provide name and when selected the other fields (address, phone number, etc) update based on the table id.
i have been pretty successful but when the id was changed to other type of data (like 'text'), the field refuses to update. does this only works with number type?
thx before. btw i use access 2010, the where condition: ="[ID]=" & [Screen].[ActiveControl]
Nov 26 2011, 12:03 PM
If [ID] and the control contain text, then the contents should be enclosed in quotes...
"[ID]='" & [... your control name ...] & "'"
Note the single-quote in two places: after the = and at the end, enclosed in double-quotes.
Nov 26 2011, 01:14 PM
thx joe it totally works!
im not that good (yet) even with expression problems, would you kindly explain thoroughly what's with the use of single-quote in that problem?
i mean i know it failed to match because the variable before is for number not strings, but i dont get it with the structure of the expression.
thank you very much
Nov 26 2011, 01:25 PM
Hi again: Glad that works for you.
In a WHERE criteria, numerics and text are treated differently. Numerics stand alone and do not need quote marks. Text values must be enclosed in quotes.
Since the WHERE expression already has double-quotes in its syntax, the single-quotes are substituted where more quotes are needed (using more double-quotes will confuse the syntax interpretation). If the value after the equal sign is named explicitly, then it would be something like this:
... indicating that ABC is a text value.
The syntax I suggested in my first post causes the WHERE statement to be interpreted this way when the control value is inserted.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here