Multi-Select Listbox as filter for Query field (1 Viewer)

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
Hello Dear friends

I want give Numbers for my field staff on their performance.
FAS is an activity.... If some one gain 500 out of 500, he will be given 10 Numbers.
if less than 500, then how to show its performance in Query. I made below query.

Expr1: IIf([FAS2]>=10,"10") it works fine

But if FAS2 is <10, how to write it in Query...

Please help.
Thanks

irsmalik
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
Try

Expr1: IIf([FAS2]>=10,"10", "Whatever")
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
No Sir pbaldy...
it is giving me word "whatever"

I want to display the value of FAS, if it is Less then 10 Number like 9, 8 or so on.
in query it must display....
Expr1: IIf([FAS2]>=10,"10")
if less than 10
Expr1: IIf([FAS2]>=10,"10", iif [FAS]<10, [FAS])
any one plz correct my query.
thanks
irsmalik
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
Yes, "whatever" meant you should put the desired result there. It's hard to correct when we don't know what the exact goal is. You've referred to 2 different fields there; is that correct? If not:

Expr1: IIf([FAS2]>=10,"10", [FAS2])

You're also mixing text and numbers there, which can give you odd results.
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
Hello Friends.........
In the Data Entry Form..... I am using following fields by using Combo Box
Company Name.......... Combo Box .. and get Company ID by using DLookup
Region Name ............ Combo Box .. and get RegionID by using Dlookup
Area Name................ Combo Box ... and get AreaID by using Dlookup...
This is working OK....

I want to Save the values I got from Dlookup........ plz some one guide me how to do it.....

Thanks
Irshad Ahmed
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
Dear Sir Pbaldy
I have check multi select your web page

Set ctl = Me.lstEmployees
For Each varItem In ctl.ItemsSelected
rs.AddNew
rs!EmpID = ctl.ItemData(varItem)
rs!OtherValue = Me.txtOtherValue
rs.Update
Next varItem

*************
Plz guide me if I want to add 1 more item in this list like
rs!EmpID = ctl.ItemData(varItem) and
rs!EmpName = ctl.ItemData(varItem)..

Thanks
irsmalik
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
This type of thing:

ctl.Column(x, varItem) use this if you need columns

where x is the zero-based column number containing the desired value.
 

dhawan_aj

New member
Local time
Today, 16:03
Joined
Feb 13, 2019
Messages
6
Sir I need help for the below query

I need you help in Microsoft Access to fix one query.


IN/OUT LOADED/EMPTY TRAILER DATE & TIME
IN LOADED 456667 2/10/2019 1:12:00 PM
IN EMPTY 53004 2/11/2019 2:00:00 PM
IN LOADED 53005 2/10/2019 2:35:00 PM
OUT LOADED 53005 2/10/2019 1:00:00 PM
IN EMPTY 53006 2/11/2019 10:35:00 AM
IN LOADED 53665 2/9/2019 4:00:00 PM
OUT LOADED 54334 2/10/2019 3:10:00 PM

I need only those entries that have "IN" and if under "Trailer" section have 2 same number then only those
come in the result whoever have greater "Date & time" and if "Out" is greater than I don't need that entry.

Please advise how I can get those results in the query. "HELP ME"
Attached Images
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
Sir PBaldy
Sorry I could not understand your line. kindly correct below lines as per your idea. Purpose is to append / update record.

Set ctl = Me.lstEmployees
For Each varItem In ctl.ItemsSelected
rs.AddNew
rs!EmpID = ctl.ItemData(varItem) Also want to Add EMP Name, Phone etc.
rs!OtherValue = Me.txtOtherValue
rs.Update
Next varItem
Thanks
irsmalik
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
Like:

rs!EmpName = ctl.ItemData(1, varItem)
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
No Sir... Pbaldy............ it is giving compile error... Plz see the attached picture.
My purpose is to Add
EmpID
EMPLName
EMPFName

thanks
irsmalik
 

Attachments

  • pcture.jpg
    pcture.jpg
    93.4 KB · Views: 83

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
Oops, try

ctl.Column(1, varItem)

You need to specify each of the field names of course.
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
Sir what would be the exact line
ctl.Column(1, varItem)

?
irsmalik
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
rs!FieldName = ctl.Column(1, varItem)
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
No Sir Pbaldy........ this is your suggested line

rs!FieldName = ctl.Column(1, varItem)

Below is my line......... I think I am making some mistake.....
rs!EmpName = ctl.ItemData(1, varItem)

Please see the attached picture for code and its error message. My Selection form is also shown in this picture.

Thanks
irsmalik
 

Attachments

  • picture.jpg
    picture.jpg
    91 KB · Views: 73

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:03
Joined
Aug 30, 2003
Messages
36,124
Try using Column instead of ItemData, as shown in post 55.
 

irsmalik

Registered User.
Local time
Tomorrow, 00:03
Joined
Jan 28, 2015
Messages
88
Thank You so Sir Pbdaldy...

Now it is working..... I realize... I call you again & again... but believe me... I learn a lot from you.

Once again Thank You.
irsmalik
 

kb44

Registered User.
Local time
Today, 16:03
Joined
Dec 31, 2018
Messages
44
I just read this thread and wow.. I give much praise @pbaldy for trying so hard to help someone even though his help requests seemed like demands at times.

There is clearly a language barrier and that seemed to be the reason.

It did not phase pbaldy. You are a VIP sir!
 

Users who are viewing this thread

Top Bottom