UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Question About Searchforrecord, Office 2010    
 
   
baba
post Nov 26 2011, 09:20 AM
Post #1

New Member
Posts: 5



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.

for example:

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]

This post has been edited by baba: Nov 26 2011, 09:23 AM
Go to the top of the page
 
+
RJD
post Nov 26 2011, 12:03 PM
Post #2

UtterAccess Ruler
Posts: 1,566
From: Gulf South USA



(IMG:style_emoticons/default/welcome2UA.gif)

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.

HTH
Joe

This post has been edited by RJD: Nov 26 2011, 12:05 PM
Go to the top of the page
 
+
baba
post Nov 26 2011, 01:14 PM
Post #3

New Member
Posts: 5



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

This post has been edited by baba: Nov 26 2011, 01:21 PM
Go to the top of the page
 
+
RJD
post Nov 26 2011, 01:25 PM
Post #4

UtterAccess Ruler
Posts: 1,566
From: Gulf South USA



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:

"[ID]='ABC'"

... 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.

HTH
Joe
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 02:16 AM