473,326 Members | 2,133 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,326 software developers and data experts.

Code Help Needed - ItemsSelected

132 100+
I have this code in a list box. I'm trying to determine which PrintButton to display based upon the users selection. When executed I get this error "Argument not optional" Any ideas?

Also, the list box's control source is a query.


If ReportList.ItemsSelected = "By Age (Open Appeals)" Then

PrintBtn1.Visible = True
PrintBtn2.Visible = False
PrintBtn3.Visible = False
PrintBtn4.Visible = False

End If
Jan 25 '08 #1
2 1855
missinglinq
3,532 Expert 2GB
.ItemsSelected takes a Long Integer for an argument, not a string, as you've used, hence the somewhat unclear error message. Assuming that "By Age (Open Appeals)" is one of the items in your listbox, you should be using the .Value property of ReportList. Since this is the Default Property, you don't really need to use it. I think a simple

If ReportList = "By Age (Open Appeals)" Then

will work.

Linq ;0)>
Jan 25 '08 #2
Proaccesspro
132 100+
.ItemsSelected takes a Long Integer for an argument, not a string, as you've used, hence the somewhat unclear error message. Assuming that "By Age (Open Appeals)" is one of the items in your listbox, you should be using the .Value property of ReportList. Since this is the Default Property, you don't really need to use it. I think a simple

If ReportList = "By Age (Open Appeals)" Then

will work.

Linq ;0)>
Worked like a TOP, Thanks!
Jan 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hohn Upshew | last post by:
I want to build a function having the name of the list box in brackets like Check(ListBoxInvoices).May i have some help as to how to do it ? In my form i have several list boxes.I have command...
1
by: Steve Edwards | last post by:
I have a form with a list box, and the items selected from that list box are used to add values to the WHERE clause of a query that is the data source for a report. For each item chosen from the...
2
by: jdph40 | last post by:
In Access 97, I have a form named frmEmpList with a list box that contains the names of all our employees. I have a command button with the following code in the OnClick event so the form will...
5
by: jdph40 | last post by:
I have a form in Access 97 on which I have an unbound list box filled with our employees names from tblEmployees. When you select an employee's name and click a button, the following code is run...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
7
by: Douglas Buchanan | last post by:
I cannot access certain column values of a list box using code. I have a list box 'lstPrv' populated by the query below. SELECT tblPrv.fkPrvID, lkpCat.CatNm, lkpSrv.SrvNm, lkpCat.pkCatID,...
1
by: | last post by:
I am having trouble getting the procedure to use a Multiselect listbox in a report to work. I am using Access 2000. Here's the code. The error I get is QueryDef "User-defined type not...
3
by: Dale | last post by:
Access 2000 Frt End (mdb) Connected to SQL data This code works when connected to an access backend, but it hangs on the Set Rec = db.OpenRecordset("Classes&Students", dbSeeChanges) with...
18
by: wmaiwand | last post by:
Hi all, I have a database that I've created a search form. Everything works great the only problem is the first time when the form is opened the search doesn't work, but after that it works. I've...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.