PC Review


Reply
Thread Tools Rate Thread

How to create a list of values using queries?

 
 
=?Utf-8?B?UEg=?=
Guest
Posts: n/a
 
      30th Jan 2006
Dears,

Good afternoon.
Could someone help me?

First of all, let me try to explain the problem:
I have a form (f1) and a sub-form (sb1).
I have a table called Deliverable with the follow fields:
Governance | Gate | Deliverable
For each Governance + Gate I can have more than one deliverable value.

In the form f1, I have a field called Governance that has the value for
Governance.
In the form sb1, I have a field called Gate that has the value for Gate.

In the form sb1, I have a list box called deliverable that I need to show
the list of deliverables.

I tried to do it, using the DLookup function:

Form_sb1.DELIVERABLE = DLookup("[DELIVERABLE]", "[DELIVERABLES]", _
"GOVERNANCE=[Form_f1.GOVERNANCE] AND GATE=[Form_sb1.Gate]")

However, as I am looking for more than one value, it doesn't work.

Also, I tried to create a query inside the OnFocus event procedure:

==============================================
Private Sub DELIVERABLE_GotFocus()

Dim XGovernance As String
Dim XGate As String
Dim qryTest As String

XGovernance = Form_f1.GOVERNANCE
XGate = Form_sb1.GATE

qryTest = "SELECT DELIVERABLE FROM DELIVERABLES WHERE GOVERNANCE='" &
XGovernance & "'And GATE='" & XGate & "';"

Form_sb1.DELIVERABLE = qryTest
Form_sb1.DELIVERABLE.Requery

End Sub

===========================================

And it doesn't work again.
Is there any other command I need to insert here?
Please, let me know how to fix it or give a new suggestion on how to do it.


Also, I tried to create a query in the Queries option, and put this query in
the RowSource property of my list box, however the values for Governance and
Gate are under the form and subform (f1 and sb1) and I don't know how to send
this parameters to the query when I execute the form.

Could you please, help me to solve this problem?


Thanks and regards.

PH.
 
Reply With Quote
 
 
 
 
Douglas J Steele
Guest
Posts: n/a
 
      30th Jan 2006
Form_sb1.DELIVERABLE.RowSource = qryTest

Also, make sure Form_sb1.DELIVERABLE.RowSourceType is set to "Table/Query"


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"PH" <(E-Mail Removed)> wrote in message
news:7533286C-B420-46C8-8F29-(E-Mail Removed)...
> Dears,
>
> Good afternoon.
> Could someone help me?
>
> First of all, let me try to explain the problem:
> I have a form (f1) and a sub-form (sb1).
> I have a table called Deliverable with the follow fields:
> Governance | Gate | Deliverable
> For each Governance + Gate I can have more than one deliverable value.
>
> In the form f1, I have a field called Governance that has the value for
> Governance.
> In the form sb1, I have a field called Gate that has the value for Gate.
>
> In the form sb1, I have a list box called deliverable that I need to show
> the list of deliverables.
>
> I tried to do it, using the DLookup function:
>
> Form_sb1.DELIVERABLE = DLookup("[DELIVERABLE]", "[DELIVERABLES]", _
> "GOVERNANCE=[Form_f1.GOVERNANCE] AND GATE=[Form_sb1.Gate]")
>
> However, as I am looking for more than one value, it doesn't work.
>
> Also, I tried to create a query inside the OnFocus event procedure:
>
> ==============================================
> Private Sub DELIVERABLE_GotFocus()
>
> Dim XGovernance As String
> Dim XGate As String
> Dim qryTest As String
>
> XGovernance = Form_f1.GOVERNANCE
> XGate = Form_sb1.GATE
>
> qryTest = "SELECT DELIVERABLE FROM DELIVERABLES WHERE GOVERNANCE='" &
> XGovernance & "'And GATE='" & XGate & "';"
>
> Form_sb1.DELIVERABLE = qryTest
> Form_sb1.DELIVERABLE.Requery
>
> End Sub
>
> ===========================================
>
> And it doesn't work again.
> Is there any other command I need to insert here?
> Please, let me know how to fix it or give a new suggestion on how to do

it.
>
>
> Also, I tried to create a query in the Queries option, and put this query

in
> the RowSource property of my list box, however the values for Governance

and
> Gate are under the form and subform (f1 and sb1) and I don't know how to

send
> this parameters to the query when I execute the form.
>
> Could you please, help me to solve this problem?
>
>
> Thanks and regards.
>
> PH.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Queries - criteria show list of values to pick from Mary Microsoft Access Queries 3 16th May 2008 05:56 PM
create a list of single values from multiple values =?Utf-8?B?Sm9yZGFu?= Microsoft Excel Worksheet Functions 3 3rd Nov 2005 11:25 PM
Count unique values and create list based on these values =?Utf-8?B?dmlwYTIwMDA=?= Microsoft Excel Worksheet Functions 7 5th Aug 2005 01:17 AM
create list of unique values from a column with repeated values? =?Utf-8?B?Q2hhZCBTY2hhYmVu?= Microsoft Excel Worksheet Functions 1 8th Jul 2005 10:25 PM
Create List of Queries dave Microsoft Excel Programming 1 14th Jan 2005 07:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:26 AM.