18988 Display a value in a field based on the value of 2 other fields
Sign Up |  Live StatsLive Stats    Articles 37,350| Comments 177,415| Members 19,424, Newest yashpal singh| Online 374
Home Contact
 (Forgotten?): 
    Ishmeet Singh - First Voice of India 2008 Winner
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags
Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » Display a value in a field based on the value of 2 other fields

Display a value in a field based on the value of 2 other fields

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Calculate field based on many side field value Martino165 Information Technology 1 28-Jul-2006 08:21 AM
Update/lookup value of one field based upon entry in previous field stevewrite@gmail.com Information Technology 2 28-Jul-2006 08:18 AM
Making a field required based on a different field dmv1947 Information Technology 1 28-Jul-2006 08:14 AM
Completing fields based on data in another field Linda Information Technology 1 16-Nov-2005 14:50 PM
why not display the fields ZGH Information Technology 1 10-Nov-2005 21:08 PM


Tags
display, value, field, based, other, fields
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 12-Nov-2005, 22:40 PM
Andrew R in Canberra's Avatar Andrew R in Canberra
Guest
 
Posts: n/a
   
   
Display a value in a field based on the value of 2 other fields

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I'm sure this should be easy, but can't make it work, can anyone help me ??
I have a form based on a table. In that table there are 2 fields that are
filled in then a 3rd field should display a result that depends on what is in
the other 2 fields.
I am trying to use an unbound field that has a query as its control source,
the query has the 2 filled in fields in it with criteria [Forms]![form
name]![field name]. This query works, ie it reads the fields in the form and
based on those criteria presents the value I want from another table. I
can't seem to get that value to display in the current forms 3rd field
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/7255-display-value-field-based-value-2-a.html
though??? Bizare, no? Any suggestions? Other methods I could use? (I've
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
also tried an action query to update the value from the query to the table,
but for some reason can't get that to display the result either???)
Many thanks in anticipation of a genius solution!
Andrew R in Canberra


Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-Nov-2005, 22:40 PM
Allen Browne's Avatar Allen Browne
Guest
 
Posts: n/a
   
   
Re: Display a value in a field based on the value of 2 other fields

As you found, you can't put a query statement into the ControlSource of a
text box. The nearest thing is probably a DLookup() expression, where
literal values from the other 2 controls is concatenated into the 3rd
argument. Something like this:
=DLookup("CreditLimit", "tblCreditLimit", "(ClientID = " &
Nz([ClientID],0) & ") AND ([Status = """ & [Status] & """)")
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255

For more help on how to form the 3rd argument, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

There might be a better solution. Could you create a query that contains the
lookup table as well as the main table for your form, and set the
RecordSource of your form to that query? If so, you can include the lookup
field in the query, and just treat it like any other field in your form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Andrew R in Canberra" Canberra@discussions.microsoft.com>
wrote in message news:9F5A91A7-AAF4-4E89-8671-A872C9F97FD6@microsoft.com...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
> I'm sure this should be easy, but can't make it work, can anyone help me
> ??
> I have a form based on a table. In that table there are 2 fields that are
> filled in then a 3rd field should display a result that depends on what is
> in
> the other 2 fields.
> I am trying to use an unbound field that has a query as its control
> source,
> the query has the 2 filled in fields in it with criteria [Forms]![form
> name]![field name]. This query works, ie it reads the fields in the form
> and
> based on those criteria presents the value I want from another table. I
> can't seem to get that value to display in the current forms 3rd field
> though??? Bizare, no? Any suggestions? Other methods I could use? (I've
> also tried an action query to update the value from the query to the
> table,
> but for some reason can't get that to display the result either???)
> Many thanks in anticipation of a genius solution!
> Andrew R in Canberra



Reply With Quote
  #3 (permalink)  
Old 12-Nov-2005, 22:40 PM
David Lloyd's Avatar David Lloyd
Guest
 
Posts: n/a
   
   
Re: Display a value in a field based on the value of 2 other fields

Andrew:

One alternative you might want to consider is the DLookup function. This
function allows you to find the value in another table or query based on
specified criteria. You could use this function to lookup your third value
based on the value of the other two fields. For example, you can set the
Control Source property of the form textbox:

=DLookup("[MyThirdFieldName]", "MyTableOrQueryName", "[MyFirstFieldName] ="
& Forms![MyFormName]!MyFirstFieldControlName & " AND [MySecondFieldName] ="
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
& Forms![MyFormName]!MySecondFieldControlName)

The following link is an MSDN reference page on how this function works.

http://msdn.microsoft.com/library/de...HV05187182.asp
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255

You will need to adjust this example for data type, and of course your form,
control and field names.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"Andrew R in Canberra" Canberra@discussions.microsoft.com>
wrote in message news:9F5A91A7-AAF4-4E89-8671-A872C9F97FD6@microsoft.com...
I'm sure this should be easy, but can't make it work, can anyone help me ??
I have a form based on a table. In that table there are 2 fields that are
filled in then a 3rd field should display a result that depends on what is
in
the other 2 fields.
I am trying to use an unbound field that has a query as its control source,
the query has the 2 filled in fields in it with criteria [Forms]![form
name]![field name]. This query works, ie it reads the fields in the form
and
based on those criteria presents the value I want from another table. I
can't seem to get that value to display in the current forms 3rd field
though??? Bizare, no? Any suggestions? Other methods I could use? (I've
also tried an action query to update the value from the query to the table,
but for some reason can't get that to display the result either???)
Many thanks in anticipation of a genius solution!
Andrew R in Canberra


Reply With Quote
  #4 (permalink)  
Old 15-Nov-2005, 14:10 PM
David Lloyd's Avatar David Lloyd
Guest
 
Posts: n/a
   
   
Re: Display a value in a field based on the value of 2 other fields

Andrew:

One alternative you might want to consider is the DLookup function. This
function allows you to find the value in another table or query based on
specified criteria. You could use this function to lookup your third value
based on the value of the other two fields. For example, you can set the
Control Source property of the form textbox:

=DLookup("[MyThirdFieldName]", "MyTableOrQueryName", "[MyFirstFieldName] ="
& Forms![MyFormName]!MyFirstFieldControlName & " AND [MySecondFieldName] ="
& Forms![MyFormName]!MySecondFieldControlName)

The following link is an MSDN reference page on how this function works.

http://msdn.microsoft.com/library/de...HV05187182.asp

You will need to adjust this example for data type, and of course your form,
control and field names.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"Andrew R in Canberra" Canberra@discussions.microsoft.com>
wrote in message news:9F5A91A7-AAF4-4E89-8671-A872C9F97FD6@microsoft.com...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
I'm sure this should be easy, but can't make it work, can anyone help me ??
I have a form based on a table. In that table there are 2 fields that are
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
filled in then a 3rd field should display a result that depends on what is
in
the other 2 fields.
I am trying to use an unbound field that has a query as its control source,
the query has the 2 filled in fields in it with criteria [Forms]![form
name]![field name]. This query works, ie it reads the fields in the form
and
based on those criteria presents the value I want from another table. I
can't seem to get that value to display in the current forms 3rd field
though??? Bizare, no? Any suggestions? Other methods I could use? (I've
also tried an action query to update the value from the query to the table,
but for some reason can't get that to display the result either???)
Many thanks in anticipation of a genius solution!
Andrew R in Canberra


Reply With Quote
  #5 (permalink)  
Old 16-Nov-2005, 14:50 PM
Andrew R in Canberra's Avatar Andrew R in Canberra
Guest
 
Posts: n/a
   
   
Re: Display a value in a field based on the value of 2 other field

  Donate Today!  


"Allen Browne" wrote:

> As you found, you can't put a query statement into the ControlSource of a
> text box. The nearest thing is probably a DLookup() expression, where
> literal values from the other 2 controls is concatenated into the 3rd
> argument. Something like this:
> =DLookup("CreditLimit", "tblCreditLimit", "(ClientID = " &
> Nz([ClientID],0) & ") AND ([Status = """ & [Status] & """)")
>
> For more help on how to form the 3rd argument, see:
> Getting a value from a table: DLookup()
> at:
> http://allenbrowne.com/casu-07.html
>
> There might be a better solution. Could you create a query that contains the
> lookup table as well as the main table for your form, and set the
> RecordSource of your form to that query? If so, you can include the lookup
> field in the query, and just treat it like any other field in your form.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Andrew R in Canberra" Canberra@discussions.microsoft.com>
> wrote in message news:9F5A91A7-AAF4-4E89-8671-A872C9F97FD6@microsoft.com...
> > I'm sure this should be easy, but can't make it work, can anyone help me
> > ??
> > I have a form based on a table. In that table there are 2 fields that are
> > filled in then a 3rd field should display a result that depends on what is
> > in
> > the other 2 fields.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7255
> > I am trying to use an unbound field that has a query as its control
> > source,
> > the query has the 2 filled in fields in it with criteria [Forms]![form
> > name]![field name]. This query works, ie it reads the fields in the form
> > and
> > based on those criteria presents the value I want from another table. I
> > can't seem to get that value to display in the current forms 3rd field
> > though??? Bizare, no? Any suggestions? Other methods I could use? (I've
> > also tried an action query to update the value from the query to the
> > table,
> > but for some reason can't get that to display the result either???)
> > Many thanks in anticipation of a genius solution!
> > Andrew R in Canberra

>
>
> Thanks - I'll try both those - in the end I used 3 hidden controls - ie 2 that displayed numbers relating to the 2 choosing fields and another that added the 2 together - I then used a table with a list of possible results and displayed the result using a combo box - It doesnt show the result automatically, but allows only the correct result to be shown!!! strange, but it works!


Thanks Allan
Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Is Science a Religion?
Today 04:49 AM
17 Replies, 2,068 Views
UNITED SIKHS AID Team...
Today 03:19 AM
0 Replies, 31 Views
Woolwich Killing: The...
Today 03:05 AM
26 Replies, 287 Views
Abu Nusaybah, 'Friend'...
Today 02:33 AM
0 Replies, 42 Views
Stockholm riots throw...
Today 02:14 AM
10 Replies, 104 Views
How does Sikhi help you...
Today 02:04 AM
48 Replies, 1,224 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 01:52 AM
186 Replies, 4,658 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:41 AM
322 Replies, 7,735 Views
Paneer: what I have...
Yesterday 22:29 PM
8 Replies, 81 Views
How Many Sikhs Have...
Yesterday 21:55 PM
698 Replies, 51,741 Views
Transgenderism ... Right...
By Kaylee
Yesterday 17:55 PM
31 Replies, 1,383 Views
Rochester Gurdwara...
Yesterday 10:55 AM
2 Replies, 85 Views
US Congress panel passes...
Yesterday 04:22 AM
0 Replies, 47 Views
Harmeet Kaur Took the...
Yesterday 03:40 AM
0 Replies, 71 Views
Panjabi Alphabet Resource
24-May-2013 23:15 PM
12 Replies, 6,565 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 07:14 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.55078 seconds with 32 queries
0