Greetings,
This is my first post so I will try to be brief and accurate.
I have a report that uses 9 user selectable filters (Dates, Y/N's as Combo Boxes and 4 Multi-Select List Boxes. 2 of the Multi-Select Boxes acquire their data from other tables as Lookup's. All functions for the filters operate properly pulling the data needed. One of my options with the data is to send it to a Report that can be printed.
The request now comes to add the filters used to a cover page. That is all accomplished, EXCEPT for the Lookup's. The Bound ID number used is sent to the report instead of the Displayed selection. How can I get that Lookup to display on the report? Alternately, is their an easier way to do what I want that I overlooked?
Sample Code is below. In this code, modified from Allen Browne's Multi-Select List Box filter code, I create an Array that stores each selection from the Multi-Select List Box and sends it to a hidden text field. That field is shown on the cover page of the report. It's messy but works. - ...
-
Dim strWhere As String
-
Dim lngLen As Long
-
-
Dim Criteria2 As String
-
Dim Criteria2Array() As String ' Array - Used to pass info to a Text Field.
-
Dim Criteria2dual As String ' Gathers looped data.
-
-
For Each j In Me![List2].ItemsSelected
-
ReDim Criteria2Array(p To 150) As String
-
If Criteria2 <> "" Then
-
Criteria2dual = Criteria2dual
-
Criteria2 = Criteria2 & " OR "
-
End If
-
Criteria2Array(p) = Criteria2dual & Me![List2].ItemData(j)
-
Criteria2dual = Criteria2dual & Me![List2].ItemData(j) & ", "
-
Criteria2 = Criteria2 & "[CSS_CSM_Names]='" & Me![List2].ItemData(j) & "'"
-
Next j
-
-
If Criteria2 > "" Then
-
Criteria2 = "(" & Criteria2 & ")"
-
strWhere = strWhere & Criteria2 & " AND "
-
MsgBox Criteria2Array(p)
-
-
If Criteria2Array(p) <> "" Then
-
Me.List2Storage.Value = Criteria2Array(p)
-
Else
-
Me.List2Storage.Value = "All Selected"
-
End If
-
-
lngLen = Len(strWhere) - 5
-
If lngLen <= 0 Then
-
MsgBox "You Have Selected All Files!", vbInformation, "Everything Selected"
-
Else
-
strWhere = Left$(strWhere, lngLen)
-
Me.Filter = strWhere
-
Me.FilterOn = True
-
End If
1 4148 mshmyob 904
Recognized Expert Contributor
To reference another column in your drop down box use the 'COLUMN' property. -
Me.txtBox.Value=Me.cboBox.Column(1)
-
You would obviously change the control names. Column(1) refers to the 1st column (0 based - column 0 is your bound column which is usually the PK).
This is just an example. You just need to reference Column(1) in your report.
Here is another way to grab values from a multi selection list box -
Dim lst1 As ListBox
-
Dim lst2 As ListBox
-
Dim itm As Variant
-
Dim vSearchString As String
-
-
-
Set lst1 = Me!lstPickFrom
-
Set lst2 = Me!lstPickTo
-
-
For Each itm In lst1.ItemsSelected
-
' Set RowSource property for first selected item.
-
If lst2.RowSource = "" Then
-
lst2.RowSource = lst1.Column(0, itm) & ";" & lst1.Column(1, itm) & ";" & lst1.Column(2, itm)
-
Else
-
' Check whether item has already been copied.
-
vSearchString = lst1.Column(0, itm) & ";" & lst1.Column(1, itm) & ";" & lst1.Column(2, itm)
-
If Not InStr(lst2.RowSource, vSearchString) > 0 Then
-
lst2.RowSource = lst2.RowSource & ";" & lst1.Column(0, itm) & ";" & lst1.Column(1, itm) & ";" & lst1.Column(2, itm)
-
-
End If
-
End If
-
Next itm
-
Here I picked up all columns from one list box and passed to another list box and populated it based on the values I picked from the 1st. You would just change it to pass them to your report or hidden controls as you indicated above.
cheers,
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rob Allen |
last post by:
I've got a lookup table for a lookup table and can't work out the SQL to
do a search. Can anyone help?
As an example, consider the following:
Table 1 - books:
fields: book_id, price, title, author
data:
1, 2.99, 'Life', 'A. Slug'
2, 4.99, 'The Universe', 'A. Planet'
|
by: J P Singh |
last post by:
Hi All
I have been given the task to create a search page to search on of the
tables in the sql database.
I have been asked that the user should be able to search any field(which I
have done) but he should also be able to customise the form to display or
hide any feilds in the results.
My table has about 20 feilds and different users...
|
by: maxal |
last post by:
have two fields, Title_Id table customers, I also have table named titles
with title_id and titles
In DataSet I have DataTable customers with fields title_id and title.
In the form I have combox that I binded to field title_id in table
customers. It works fine, field title_id is updated correctly. However, field
title remains the same.
I...
|
by: DettCom |
last post by:
Hello,
I would like to be able to display or hide fields based on whether a
specific Yes/No radio button is selected. This is in conjunction with
a posting a just made here in the same group related to checkboxes.
Thanks!!!
|
by: David Allison |
last post by:
Should Lookup fields be replaced by table normalisation? Then the Tables
brought together in a Query for a Form to be based on?
--
Dave Allison ~ Scotland
| |
by: John Baker |
last post by:
Hi:
I have a general question about table access and look ups.
Over simplifying things,and using a very theoretical example, lets say I have two tables;
Client and Bill.
The client table has a unique auto number (which is indexed) and the Client name, as well
as address and other key data
|
by: google |
last post by:
I have a database with four table. In one of the tables, I use about
five lookup fields to get populate their dropdown list. I have read
that lookup fields are really bad and may cause problems that are hard
to find. The main problem I am having right now is that I have a report
that is sorted by one of these lookup fields and it only displays...
|
by: Roland Wolters |
last post by:
Hi,
This tast seems so simple but I can't seem to crack it:
I have some data in a dataset. I can bind the dataset to a datalist control
and show the fieldvalues but i would have to hardcode the filednames.
Problem is that I just want to show ALL the fields without knowing what
table is loaded. I do not know what fields are present.
|
by: computerider |
last post by:
I have a standard two-table structure, Orders which has a lookup field to the Salesperson table. However when you build a form the salesperson field has the combo box feature - which I WANT when adding new orders BUT NOT when viewing existing orders (because you can actually change the salesperson by using it) - I am guessing I must use code (have...
|
by: Lance Williams |
last post by:
How can you programatically tell if a field in a table is a lookup field? I am looping through the fields collection and I want to see if any fields are lookup fields.
Is there a property, or something taht will tell me if the field is a lookup field.
I need to do this at the table level and not at the form level because if a field is a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |