473,419 Members | 1,605 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,419 software developers and data experts.

Dlookup

Trying to lookup a field from a table called condition this is a separate
table not linked to anything: setup as shown
Code S M L
DG 1 2 3
RI 2 4 5
need a dlookup to give me a single code as in number 1 2 3
all from a form thats entered by user
ie: condition code DG severity L nedd to return 5
cheers
Dec 19 '05 #1
13 2924
On Mon, 19 Dec 2005 22:32:31 GMT, "nzyui" <u16807@uwe> wrote:
Trying to lookup a field from a table called condition this is a separate
table not linked to anything: setup as shown
Code S M L
DG 1 2 3
RI 2 4 5
need a dlookup to give me a single code as in number 1 2 3
all from a form thats entered by user
ie: condition code DG severity L nedd to return 5


What have you tried that hasn't worked?

mike
Dec 19 '05 #2
Mike Preston wrote:
Trying to lookup a field from a table called condition this is a separate
table not linked to anything: setup as shown

[quoted text clipped - 4 lines]
all from a form thats entered by user
ie: condition code DG severity L nedd to return 5


What have you tried that hasn't worked?

mike


I can get the results by typing in the numbers manually need to to aquire
these numbers from forms
Dec 19 '05 #3
On Mon, 19 Dec 2005 23:40:43 GMT, "nzyui" <u16807@uwe> wrote:
Mike Preston wrote:
Trying to lookup a field from a table called condition this is a separate
table not linked to anything: setup as shown

[quoted text clipped - 4 lines]
all from a form thats entered by user
ie: condition code DG severity L nedd to return 5


What have you tried that hasn't worked?

mike


I can get the results by typing in the numbers manually need to to aquire
these numbers from forms


Need more information. Be liberal with your keystrokes. Imagine
there are hordes of people who wish to assist you, if only you fed
them enough information so that they could. I know it is tough. But
you must.

mike
Dec 19 '05 #4
Mike Preston wrote:
Trying to lookup a field from a table called condition this is a separate
table not linked to anything: setup as shown

[quoted text clipped - 8 lines]
I can get the results by typing in the numbers manually need to to aquire
these numbers from forms


Need more information. Be liberal with your keystrokes. Imagine
there are hordes of people who wish to assist you, if only you fed
them enough information so that they could. I know it is tough. But
you must.

mike

OK
i have been able to lookup the condition table putting info in manually using
the following
=DLookUp("[M]","Condition","[code] = 'DG'") the results are fine , but i dont
want to keep doing this manually off course
the info on my subform shows condition code which could be S M L with this
there is a condition code eg: DG RI ETC
with the example above need forms to put the "M" in and code DG from forms
hope this is more explicit for you
thank you
Dec 20 '05 #5
On Tue, 20 Dec 2005 00:18:06 GMT, "nzyui" <u16807@uwe> wrote:
Mike Preston wrote:
>Trying to lookup a field from a table called condition this is a separate
>table not linked to anything: setup as shown[quoted text clipped - 8 lines]
I can get the results by typing in the numbers manually need to to aquire
these numbers from forms


Need more information. Be liberal with your keystrokes. Imagine
there are hordes of people who wish to assist you, if only you fed
them enough information so that they could. I know it is tough. But
you must.

mike

OK
i have been able to lookup the condition table putting info in manually using
the following
=DLookUp("[M]","Condition","[code] = 'DG'") the results are fine , but i dont
want to keep doing this manually off course


I'm not sure I understand. The above "lookup" does exactly what you
want. And while you can make it slightly more efficient using VBA,
for something as trivial as two rows and 3 fields, I think Dlookup
works fine.

But your use of the word "manually" gives me pause. What do you mean
by that? Are you taking the two fields "M" and "CODE" (as input by
the user) and then doing something yourself to run the Dlookup? Like
in the debug window? That would truly be "manually".
the info on my subform shows condition code which could be S M L with this
there is a condition code eg: DG RI ETC
with the example above need forms to put the "M" in and code DG from forms
hope this is more explicit for you


It is more explicit, but not quite explicit enough.

You already have the Dlookup function available to you.

What else are you looking for? Where do you intend to use it?

mike
Dec 20 '05 #6
Mike Preston wrote:
>>Trying to lookup a field from a table called condition this is a separate
>>table not linked to anything: setup as shown

[quoted text clipped - 14 lines]
=DLookUp("[M]","Condition","[code] = 'DG'") the results are fine , but i dont
want to keep doing this manually off course


I'm not sure I understand. The above "lookup" does exactly what you
want. And while you can make it slightly more efficient using VBA,
for something as trivial as two rows and 3 fields, I think Dlookup
works fine.

But your use of the word "manually" gives me pause. What do you mean
by that? Are you taking the two fields "M" and "CODE" (as input by
the user) and then doing something yourself to run the Dlookup? Like
in the debug window? That would truly be "manually".
the info on my subform shows condition code which could be S M L with this
there is a condition code eg: DG RI ETC
with the example above need forms to put the "M" in and code DG from forms
hope this is more explicit for you


It is more explicit, but not quite explicit enough.

You already have the Dlookup function available to you.

What else are you looking for? Where do you intend to use it?

mike

Yes all i want is the forms to pick up the 2 fields M for example and DG for
example to give me a number from the condition table which transposes into a
field call score
Dec 20 '05 #7
On Tue, 20 Dec 2005 00:55:49 GMT, "nzyui" <u16807@uwe> wrote:
Mike Preston wrote:
>>>Trying to lookup a field from a table called condition this is a separate
>>>table not linked to anything: setup as shown

[quoted text clipped - 14 lines]
=DLookUp("[M]","Condition","[code] = 'DG'") the results are fine , but i dont
want to keep doing this manually off course


I'm not sure I understand. The above "lookup" does exactly what you
want. And while you can make it slightly more efficient using VBA,
for something as trivial as two rows and 3 fields, I think Dlookup
works fine.

But your use of the word "manually" gives me pause. What do you mean
by that? Are you taking the two fields "M" and "CODE" (as input by
the user) and then doing something yourself to run the Dlookup? Like
in the debug window? That would truly be "manually".
the info on my subform shows condition code which could be S M L with this
there is a condition code eg: DG RI ETC
with the example above need forms to put the "M" in and code DG from forms
hope this is more explicit for you


It is more explicit, but not quite explicit enough.

You already have the Dlookup function available to you.

What else are you looking for? Where do you intend to use it?

mike

Yes all i want is the forms to pick up the 2 fields M for example and DG for
example to give me a number from the condition table which transposes into a
field call score


Have you tried putting the Dlookup function in the controlsource of
your score control? Just as you typed it above:

=DLookUp("[M]","Condition","[code] = 'DG'")

Oh, wait.

I think I get it.

Let's assume that you have two controls, the first of which we shall
assume is named txtSize and the second of which is named txtCode. We
shall assume that the user has typed an "M" into txtSize and "DG" into
txtCode.

You want your score control's controlsource to be:

=DLookUp(me.txtSize,"Condition","[code] = '" & txtCode & "')

Try that.

mike
Dec 20 '05 #8
Mike Preston wrote:
>>>>Trying to lookup a field from a table called condition this is a separate
>>>>table not linked to anything: setup as shown

[quoted text clipped - 27 lines]
example to give me a number from the condition table which transposes into a
field call score


Have you tried putting the Dlookup function in the controlsource of
your score control? Just as you typed it above:

=DLookUp("[M]","Condition","[code] = 'DG'")

Oh, wait.

I think I get it.

Let's assume that you have two controls, the first of which we shall
assume is named txtSize and the second of which is named txtCode. We
shall assume that the user has typed an "M" into txtSize and "DG" into
txtCode.

You want your score control's controlsource to be:

=DLookUp(me.txtSize,"Condition","[code] = '" & txtCode & "')

Try that.

mike

Yes Mike you are on the right track that code did not work i have 2 controls
1 is Condition code the other is Severity these 2 codes make up the dlookup
to put in score ,the return is a number, condition code is txt and Severity
is txt Condition code = DG Severity = M ps i got a #name? error
cheers
Dec 20 '05 #9
On Tue, 20 Dec 2005 01:32:34 GMT, "nzyui" <u16807@uwe> wrote:
Mike Preston wrote:
>>>>>Trying to lookup a field from a table called condition this is a separate
>>>>>table not linked to anything: setup as shown

[quoted text clipped - 27 lines]
example to give me a number from the condition table which transposes into a
field call score


Have you tried putting the Dlookup function in the controlsource of
your score control? Just as you typed it above:

=DLookUp("[M]","Condition","[code] = 'DG'")

Oh, wait.

I think I get it.

Let's assume that you have two controls, the first of which we shall
assume is named txtSize and the second of which is named txtCode. We
shall assume that the user has typed an "M" into txtSize and "DG" into
txtCode.

You want your score control's controlsource to be:

=DLookUp(me.txtSize,"Condition","[code] = '" & txtCode & "')

Try that.

mike

Yes Mike you are on the right track that code did not work i have 2 controls
1 is Condition code the other is Severity these 2 codes make up the dlookup
to put in score ,the return is a number, condition code is txt and Severity
is txt Condition code = DG Severity = M ps i got a #name? error


Show me exactly what you typed and tell me where you put it.

mike
Dec 20 '05 #10
Mike Preston wrote:
>>>>>>Trying to lookup a field from a table called condition this is a separate
>>>>>>table not linked to anything: setup as shown

[quoted text clipped - 27 lines]
to put in score ,the return is a number, condition code is txt and Severity
is txt Condition code = DG Severity = M ps i got a #name? error


Show me exactly what you typed and tell me where you put it.

mike

=DLookUp(me.Severity,"Condition","[code] = '" & Condition code & "')
this is what i have in the control source of the score control
Steve
Dec 20 '05 #11
On Tue, 20 Dec 2005 02:27:10 GMT, "nzyui" <u16807@uwe> wrote:
Mike Preston wrote:
>>>>>>>Trying to lookup a field from a table called condition this is a separate
>>>>>>>table not linked to anything: setup as shown

[quoted text clipped - 27 lines]
to put in score ,the return is a number, condition code is txt and Severity
is txt Condition code = DG Severity = M ps i got a #name? error


Show me exactly what you typed and tell me where you put it.

mike

=DLookUp(me.Severity,"Condition","[code] = '" & Condition code & "')
this is what i have in the control source of the score control


=DLookUp(me.Severity,"Condition","[code] = '" & me.[Condition code] &
'")

Note that your single and double quotes are reversed, too.

mike
Dec 20 '05 #12
"Me." won't work in the Control Source of a control, just in VBA. There is
also a double quote missing at the end.

Modifying the line you have:
=DLookUp([Severity],"Condition","[code] = '" & [Condition code] & "'")

This assumes that the severity is in a control called [Severity] and that
the condition code is in a control called [Condition Code] (without the
brackets in the control name, but they are needed here). Condition would be
the name of the table and Code would be the name of the filtering field in
the Condition table. You will return a result from the field (S, M, or L)
named by the control Severity.

If this gives an error, please post what that error is.

--
Wayne Morgan
MS Access MVP
"Mike Preston" <mb******@pacbell.net.invalid> wrote in message
news:43*****************@news.INDIVIDUAL.NET...
On Tue, 20 Dec 2005 02:27:10 GMT, "nzyui" <u16807@uwe> wrote:
Mike Preston wrote:
>>>>>>>>Trying to lookup a field from a table called condition this is a
>>>>>>>>separate
>>>>>>>>table not linked to anything: setup as shown
[quoted text clipped - 27 lines]
to put in score ,the return is a number, condition code is txt and
Severity
is txt Condition code = DG Severity = M ps i got a #name?
error

Show me exactly what you typed and tell me where you put it.

mike

=DLookUp(me.Severity,"Condition","[code] = '" & Condition code & "')
this is what i have in the control source of the score control


=DLookUp(me.Severity,"Condition","[code] = '" & me.[Condition code] &
'")

Note that your single and double quotes are reversed, too.

mike

Dec 20 '05 #13
Wayne Morgan wrote:
"Me." won't work in the Control Source of a control, just in VBA. There is
also a double quote missing at the end.

Modifying the line you have:
=DLookUp([Severity],"Condition","[code] = '" & [Condition code] & "'")

This assumes that the severity is in a control called [Severity] and that
the condition code is in a control called [Condition Code] (without the
brackets in the control name, but they are needed here). Condition would be
the name of the table and Code would be the name of the filtering field in
the Condition table. You will return a result from the field (S, M, or L)
named by the control Severity.
Wayne works perfect thanks very much
thanks to mike for his help too
cheers guysIf this gives an error, please post what that error is.
>>>>>>>>>Trying to lookup a field from a table called condition this is a
>>>>>>>>>separate

[quoted text clipped - 17 lines]

mike

Dec 20 '05 #14

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

Similar topics

1
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one...
6
by: JLM | last post by:
What am I missing here? I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each "class code." Key...
5
by: Kalvin Schroder | last post by:
I am fairly new to Access, and am trying to put together an invoice form. The main form in called InvoiceDetailFm. Source is the table InvoiceDetail and has invoice number, saleman, and CustID as...
4
by: MLH | last post by:
I have tried using DLookUp in this manner... If DLookUp("","tblClients","='2021234567'") Then MsgBox "Found it!" End If I am wondering if that is a misuse of the DLookUp command? Type...
2
by: ctyrrell | last post by:
I have read with interest the many discussions of the 3048 Error: Cannot open any more databases. I understand how the number of open Table ID's causes the problem. My question has to do with the...
8
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb ...
11
by: MLH | last post by:
DLookup("", "tblPreliminaryVINs", "=Forms!frmVINODO!SerialNum") is giving me a Type Mismatch error. That's confusing to me and I don't know how to circumvent it. The field in...
2
by: Don | last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with Access. I've been creating databases for several years for work with the help of many of you and trial and error. I have...
9
by: | last post by:
In my database I have a 'control table' in which basic info is stored about the application, for instance the application's path and the name of the company that is using it. In all of the...
15
by: rleepac | last post by:
This is a little complicated but I'll do my best to explain. In my db I have a table called L_AgeCorrection which has the following fields: Age, Sex, Frequency, AgeValue This is a table used to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.