Two fields of information to query on form

K

KiowaPilot

I am having trouble.. I am trying to query information from a table but
cannot seem to get it to work. I have two text boxes Temperature and Pressure
Altitude on a Form. A third text box to display the relation between the two.
Since I am a access beginer I am having trouble. I have tried DLookup but it
doesnt allow me to make the expression Pressure Altitude # from the form.
but I got the temp to work
Is there another function or tool that I havnt discovered yet that makes
this too easy.

Pressure Altitude 0 1000 2000 3000
temp
-10 50 50 50 50
10 40 38 35 30
20 38 35 34 28
 
K

Ken Snell \(MVP\)

DLookup("temp", "NameOfYourTable", "[Pressure]=" &
Forms!NameOfYourForm!NameOfPressureTextbox & " And [Altitude]=" &
Forms!NameOfYourForm!NameOfAltitudeTextbox)
 
K

KiowaPilot

I truly appriciate your help but it did'nt work.
here is how I wrote it, I get a message that says " The expression you wrote
contains an invalid syntax" Once this is done I am going to use this
expression for several other charts.

= DLookup("temp", "MAX TORQUE AVAIL", "[Pressure]=" &
Forms!FINAL PRODUCT![TEXT330] & "AND[Altitude]=" &
Forms!FINAL PRODUCT![TEXT332])

Ken Snell (MVP) said:
DLookup("temp", "NameOfYourTable", "[Pressure]=" &
Forms!NameOfYourForm!NameOfPressureTextbox & " And [Altitude]=" &
Forms!NameOfYourForm!NameOfAltitudeTextbox)
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


KiowaPilot said:
I am having trouble.. I am trying to query information from a table but
cannot seem to get it to work. I have two text boxes Temperature and
Pressure
Altitude on a Form. A third text box to display the relation between the
two.
Since I am a access beginer I am having trouble. I have tried DLookup but
it
doesnt allow me to make the expression Pressure Altitude # from the form.
but I got the temp to work
Is there another function or tool that I havnt discovered yet that makes
this too easy.

Pressure Altitude 0 1000 2000 3000
temp
-10 50 50 50 50
10 40 38 35 30
20 38 35 34 28
 
J

John W. Vinson

I truly appriciate your help but it did'nt work.
here is how I wrote it, I get a message that says " The expression you wrote
contains an invalid syntax" Once this is done I am going to use this
expression for several other charts.

= DLookup("temp", "MAX TORQUE AVAIL", "[Pressure]=" &
Forms!FINAL PRODUCT![TEXT330] & "AND[Altitude]=" &
Forms!FINAL PRODUCT![TEXT332])

Two possible problems: some missing blanks - you should use

" AND [Altitude]="

instead of

"AND[Altitude]="

or else it will jam up the content of TEXT330 against the AND, giving you
something like

[Pressure] = 1014AND[Altitude]=

The second is that if either PRESSURE or ALTITUDE are Text fields (I hope
they're not!) you will need quotemark delimiters.

A third possible problem - do you have a record with a value in the field
named [temp] in the [MAX TORQUE AVAILABLE] table for *every possible
combination* of PRESSURE and ALTITUDE? that'll be a big table if your altitude
field is in integer feet!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top