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

Feeling dunb today can't get my head round a seemingl;y simple query...

Hi all,

I have a form with some unbound combo's and a list box that are used to
requery the dataset behind the form.

All was working fine until i added the list box.

I have the record set of the form looking at that value sin the combo
boxes and handling everything loverly but when i try to use the data
from the list box, it all goes a bit wierd...

I want someone to be able to have a blank in the list box and get
everything or click on one or more items in the list box and get those
items only... it's not difficult right??? But null's have left me in a
dilema and i'm struggling to get this working...

After much faffing about i have the following criteria in the list box
field selection:

Like IIf([forms]![frm_audit_form]![listbox] Is
Null,"*",[forms]![frm_audit_form]![listbox]) Or In
([forms]![frm_audit_form]![listbox])

So if I just use 'In' the list and the list is blank i don't get
everything...

I'm obviously missing the point and i'm sure i've had this working once
before at another company i worked at but I just can;t remember how...

Any ideas? Do you need more info to bea ble to help???

many Thanks,

Rob.

Nov 13 '05 #1
6 1348
> After much faffing about i have the following criteria in the list box
field selection:

Like IIf([forms]![frm_audit_form]![listbox] Is
Null,"*",[forms]![frm_audit_form]![listbox]) Or In
([forms]![frm_audit_form]![listbox])


Hi Rob,
Try to change the IIf(whatever Is Null, DoThis , DoThat) to
IIf(Isnull(whatever), this, that)
Also: Is your listbox.value Null or "" ??

You also could use some simple code to requery your data on the AfterUpdate_Event of your listbox
Private Sub Listbox_AfterUpdate(Cancel As Integer)
If IsNull(Me!Listbox)
Me.recordsource="QryShowAll"
Me.requery 'Not sure this is even needed here ...
Else
Me.recordsource="QryFilteredRecs"
Me.requery 'Not sure this is even needed here ...
End if
End Sub
--
Hope this helps
Arno R



Nov 13 '05 #2
Arno,

Good to hear from you.

The list box value can be null (i.e. blanked out) or one or more
values. Hmmm perhaps it isn't after all and i'm checking the wrong way
round...

I want the form to work with a refresh button (for the users sake)
rather than a lovely live update selection... This is set up and
working - i could add that code in there.

So i select from the various combo boxes (all handled and working
together fine) with the list box... However, it is something in the
logic of the query that is not working.

The query is the record source for the form and so i want to just put
in the right criteria to get the list box to be used in the query...
ack my brain hurts!

Rob.

Nov 13 '05 #3
Arno,

Good to hear from you.

The list box value can be null (i.e. blanked out) or one or more
values. Hmmm perhaps it isn't after all and i'm checking the wrong way
round...

I want the form to work with a refresh button (for the users sake)
rather than a lovely live update selection... This is set up and
working - i could add that code in there.

So i select from the various combo boxes (all handled and working
together fine) with the list box... However, it is something in the
logic of the query that is not working.

The query is the record source for the form and so i want to just put
in the right criteria to get the list box to be used in the query...
ack my brain hurts!

Rob.

Nov 13 '05 #4
If i debug.print Me!ListBox.Value during the refresh I get Null as the
Value no matter what values are in the listbox... I am obviously
missing something fundamental...

Rob.

Nov 13 '05 #5
Bri

dkintheuk wrote:
If i debug.print Me!ListBox.Value during the refresh I get Null as the
Value no matter what values are in the listbox... I am obviously
missing something fundamental...

Rob.


Is the Listbox Multi-Select set to None? If not then the value(s) are in
the .ItemsSelected property of the Listbox.

--
Bri

Nov 13 '05 #6
Oh well, i need to really read my typing more effectivly, missed out
one letter and it made all the difference... have now altered the way
i'm doing this but have a new problem. Will work out what is going on
and ask if i need to.

Thanks Arno.

Rob.

Nov 13 '05 #7

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

Similar topics

4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
2
by: Fendi Baba | last post by:
I created a person table with various fields such as Suffix, Salutation, etc, Some of these fields may not be mandatory for example suffix. In the actual table itself, I only have a field for...
4
by: Kun | last post by:
i have a form which takes in inputs for a mysql query. one of the inputs is 'date'. normally, a user has to manually enter a date, but i am wondering if there is a way to create a button which...
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
10
by: recordlovelife | last post by:
Hello theScripts, i've been using a lot of tutorials and forum reads here, so i figured it was time i joined. I've found everything here nothing but helpful. I was wondering if you all could give...
1
osward
by: osward | last post by:
Hi everyone, Background 1. I have a table that consits 400+ rows of data and is growing by day. The table already has paging links at the bottom but I restricted to display rows of data only >=...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.