Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab query to return a value 1

Status
Not open for further replies.

BrenoAguiar

IS-IT--Management
Feb 8, 2005
81
0
0
US
I have a cosstab query "cross1" that brings the result:

placeID | 001 | 002 | 003 |

21 02 03 78
28 12 0 45
02 05 10 20



I have an unbound form with a combo box having the "placeID" options and another Combo box with the "items", beeing the items 001, 002, 003, and so on..
What I want is that if the user selects the combo "items" and the value = 0, then End sub. I tried Something like this:

If DLookup("[Me.items]", "[cross1]", "[placeID] = Me.placeID)= 0 Then
MsgBox "You selected an Item that is Showing 0.", vbOKOnly, "NO item available"
Exit Sub

Can I use the Me.items value as a field in the Dlookup function?

Thanks for any help at all!
 
Something like this ?
If DLookup("[" & Me!items & "]", "cross1", "placeID=" & Me.placeID) = 0 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Why use the crosstab query? Can't you just get the value (of 0, if appropriate) from the source table(s) of the crosstab query in order to determine when the value is 0?

Bob S.
 
That Worked good PHV!

Bob, I have dif. items and dif. places that can be added or deleted by users. Also the value of the items are a sum or subtraction of another table, and thats the reason of the query. But I understood what you said and tried that primarily, but it would not work with other queries I had.

I thank you both for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top