473,379 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

ControlSource Property Woes

Good day,

I have:

1) A table with numbered fields (1, 2, 3, etc.)

2) A form text box, whose ControlSource property contains an
expression. This expression returns a number.

If I just put a number in the ControlSource property, the text box
would display the appropriate contents of the field in my table.
However, because I have an expression returning a number, the text box
displays the number. How can I get the ControlSource property to
recognize the number as a field name and get the appropriate value for
me?

Thank you!
Shelli Carol
Scottsdale, Arizona
Nov 12 '05 #1
3 4188
The number is returned by an expression. If I put the expression in
brackets, I get a ?Name error on my form. I can't put the number in
brackets because it only exists after the form is created using the
expression.

"Allen Browne" <ab***************@bigpond.net.au> wrote in message news:<Pk*******************@news-server.bigpond.net.au>...
Enclose the number in square brackets.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Shelli Carol" <st*********@yahoo.com> wrote in message
news:73**************************@posting.google.c om...
Good day,

I have:

1) A table with numbered fields (1, 2, 3, etc.)

2) A form text box, whose ControlSource property contains an
expression. This expression returns a number.

If I just put a number in the ControlSource property, the text box
would display the appropriate contents of the field in my table.
However, because I have an expression returning a number, the text box
displays the number. How can I get the ControlSource property to
recognize the number as a field name and get the appropriate value for
me?

Thank you!
Shelli Carol
Scottsdale, Arizona

Nov 12 '05 #2
Hi Allen,

Yes, I have a table with the first field named "1", the next named
"2", etc.

As I said before, I have an expression, namely a DLookup, pulling the
numbers from somewhere else. When I put this: [DLookup(arguments)]
in the ControlSource property, I only get a #Name? error in the text
box.

Thanks,
Shelli

"Allen Browne" <ab***************@bigpond.net.au> wrote in message news:<KQ*******************@news-server.bigpond.net.au>...
Shelli, you say you have a table with numbered fields.
Does this mean the first field is named "1", and the next field is named
"2"?

If so, you can refer to them in the ControlSource of a text box like this:
=[1] + [2]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Shelli Carol" <st*********@yahoo.com> wrote in message
news:73**************************@posting.google.c om...
The number is returned by an expression. If I put the expression in
brackets, I get a ?Name error on my form. I can't put the number in
brackets because it only exists after the form is created using the
expression.

"Allen Browne" <ab***************@bigpond.net.au> wrote in message

news:<Pk*******************@news-server.bigpond.net.au>...
Enclose the number in square brackets.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Shelli Carol" <st*********@yahoo.com> wrote in message
news:73**************************@posting.google.c om...
> Good day,
>
> I have:
>
> 1) A table with numbered fields (1, 2, 3, etc.)
>
> 2) A form text box, whose ControlSource property contains an
> expression. This expression returns a number.
>
> If I just put a number in the ControlSource property, the text box
> would display the appropriate contents of the field in my table.
> However, because I have an expression returning a number, the text box
> displays the number. How can I get the ControlSource property to
> recognize the number as a field name and get the appropriate value for
> me?
>
> Thank you!
> Shelli Carol
> Scottsdale, Arizona

Nov 12 '05 #3
To lookup the value of the field named "2", where the field named "1"
contains "SomeValue
=DLookup("[2]", "MyTable", "[1] = 'SomeValue'")

The square brackets are crucial. If "1" is a Number field, lose the extra
quotes, i.e.:
=DLookup("[2]", "MyTable", "[1] = 9876")

If the value is in another text box, you need to concatenate the value into
the 3rd argument, i.e.:
=DLookup("[2]", "MyTable", "[1] = " & [MyTextBox])
or for a text field:
=DLookup("[2]", "MyTable", "[1] = """ & [MyTextBox] & """")

You may like to use the Immediate Window to test this and get it right.
Press Ctrl+G, and enter:
? DLookup("[2]", "MyTable", "[1] = 'SomeValue'")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Shelli Carol" <st*********@yahoo.com> wrote in message
news:73*************************@posting.google.co m...
Hi Allen,

Yes, I have a table with the first field named "1", the next named
"2", etc.

As I said before, I have an expression, namely a DLookup, pulling the
numbers from somewhere else. When I put this: [DLookup(arguments)]
in the ControlSource property, I only get a #Name? error in the text
box.

Thanks,
Shelli

"Allen Browne" <ab***************@bigpond.net.au> wrote in message

news:<KQ*******************@news-server.bigpond.net.au>...
Shelli, you say you have a table with numbered fields.
Does this mean the first field is named "1", and the next field is named
"2"?

If so, you can refer to them in the ControlSource of a text box like this: =[1] + [2]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Shelli Carol" <st*********@yahoo.com> wrote in message
news:73**************************@posting.google.c om...
The number is returned by an expression. If I put the expression in
brackets, I get a ?Name error on my form. I can't put the number in
brackets because it only exists after the form is created using the
expression.

"Allen Browne" <ab***************@bigpond.net.au> wrote in message

news:<Pk*******************@news-server.bigpond.net.au>...
> Enclose the number in square brackets.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
>
> "Shelli Carol" <st*********@yahoo.com> wrote in message
> news:73**************************@posting.google.c om...
> > Good day,
> >
> > I have:
> >
> > 1) A table with numbered fields (1, 2, 3, etc.)
> >
> > 2) A form text box, whose ControlSource property contains an
> > expression. This expression returns a number.
> >
> > If I just put a number in the ControlSource property, the text box
> > would display the appropriate contents of the field in my table.
> > However, because I have an expression returning a number, the text box > > displays the number. How can I get the ControlSource property to
> > recognize the number as a field name and get the appropriate value for > > me?
> >
> > Thank you!
> > Shelli Carol
> > Scottsdale, Arizona

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mark | last post by:
O, woe is me, to have seen what I have seen, see what I see! (That's Shakespeare for those who were wondering what I'm on about) I am "having fun" with cookies. And I wonder if I have...
4
by: Steve Jorgensen | last post by:
Hi all, This is actually not an issue of mine, but one a friend of mine told me about that I was able to confirm. Let's say you want a highly customizable report, so you want to be able to do...
1
by: Mexar | last post by:
My programming grammar might be a little off but I have a pretty good idea of what I need to convey. I am making an Access database with a form that pops up and lets you choose to select an...
5
by: ChristianC | last post by:
I have 2 different forms that have synchronized combo boxes (selecting an option in one, changes the options available in the second). The problem is, when I save the record and open the table where...
3
by: Michael R | last post by:
Hello. I need a help to solve the following: I'm intersted in having the Control Source of a textbox as following: ="Comment, " & When I input this from Design View into the Control...
2
by: brnkstyle | last post by:
I want to change the controlsource of a textbox when i click a command button but everytime i do so it gives me #Name$ in the text boxt this is what i want to control source to be ...
13
by: ringer | last post by:
Hi, I have a text box on report where I need to have dsum return a total. The records I need the total from are not in the table that is the report's recordsource, and to complicate things...
0
by: =?Utf-8?B?Q2hyaXN0aWFuIEJhaG5zZW4=?= | last post by:
Is it possible to bind a data access page textbox controlsource property at run time? I've tried using the BeforeInitialBind event to set the controlsource for textboxes, using syntax like ...
14
by: OldBirdman | last post by:
I have a textbox on a continuous form that I want to display a calculated value. I have set the ControlSource Property = & "~" & . I would like to have my user be able to correct this value, and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.