dbTalk Databases Forums  

How do I use a value from an unbound listbox on a different form inquery builder.

comp.databases.ms-access comp.databases.ms-access


Discuss How do I use a value from an unbound listbox on a different form inquery builder. in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Luft
 
Posts: n/a

Default How do I use a value from an unbound listbox on a different form inquery builder. - 06-10-2010 , 11:53 AM






Using Access 2007, I need to modify a row source property of a combo
box via the query builder so that the "Or" row of one of the fields
refers to the value of one of the columns in a list box on the main
form. The list box on the main form has a bound column but it isn't
the one I need.

Here is a more detailed description:

I have a helpdesk application that has a form that is used to enter/
display progress records for a helpdesk incident. On this form there
is a combo box that allows the help provider to choose his/her name
when entering a new progress record. When a user selects a progress
record from a main list this form is displayed with the detail record
and the combo box is populated with the help provider's name.

All was well for years. But as time went on and staff left and new
staff hired we decided that we needed to add an active flag to the
list of providers so that only employees that were still working for
us would be displayed.

The problem is that because this form is used to display old records
as well as enter new records the existing progress records where the
provider at the time was no longer active does not show the inactive
provider's name.

I wrote this application ten years ago. What would have been easy
then seems challenging to me now. I know what I want to do but I
don't remember how to do it.

I think I need to refer to the listbox column something like
<listbox>.Column(col, row) but I don't if anything like this is
possible through the query builder and I don't remember how to the row
number of the selected row in the main form's listbox.

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: How do I use a value from an unbound listbox on a different formin query builder. - 06-10-2010 , 12:14 PM






Luft wrote:
Quote:
Using Access 2007, I need to modify a row source property of a combo
box via the query builder so that the "Or" row of one of the fields
refers to the value of one of the columns in a list box on the main
form. The list box on the main form has a bound column but it isn't
the one I need.

Here is a more detailed description:

I have a helpdesk application that has a form that is used to enter/
display progress records for a helpdesk incident. On this form there
is a combo box that allows the help provider to choose his/her name
when entering a new progress record. When a user selects a progress
record from a main list this form is displayed with the detail record
and the combo box is populated with the help provider's name.

All was well for years. But as time went on and staff left and new
staff hired we decided that we needed to add an active flag to the
list of providers so that only employees that were still working for
us would be displayed.

The problem is that because this form is used to display old records
as well as enter new records the existing progress records where the
provider at the time was no longer active does not show the inactive
provider's name.

I wrote this application ten years ago. What would have been easy
then seems challenging to me now. I know what I want to do but I
don't remember how to do it.

I think I need to refer to the listbox column something like
listbox>.Column(col, row) but I don't if anything like this is
possible through the query builder and I don't remember how to the row
number of the selected row in the main form's listbox.
I created a listbox from a table with 2 fields. I entered the following
in the Listbox's after update event.
MsgBox Me.List0.Column(0) & "-" & Me.List0.Column(1)

This shows me the values in both columns

Perhaps you can modify the rowsource's Where clause. Then in the After
Update event of the listbox do something like
Dim strVal as string
strVal = Me.List0.Column(x) 'x being the value needed.
If Me.strVal = "A" then
Me.Text0 = "123"
Elseif Me.strVal = "B" then
Me.Text0 = "456"
Else
Me.Text0 = "789"
Endif
Me.YourComboBoxName.Requery

Drop a new Textbox onto the form with 'Text0' as the name. Now in the
Combo's Rowsourse you could have something like
Select ... Where MyTableFieldName = Forms!YourFormName

Now it will update the combo based on the value of the Text0 value.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.