Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating dropdown from query

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
I have no idea how to do this but what I want to do is populate a combo drop down box from results of a report. I want it to run a report based on month (january, february, etc) it will pass the month selection to the report to filter an owners name. i want the owners name to be added to the drop down box. It also must check if the owners name is already as a value in the drop down box if so it will skip.

Does anyone have any code they can post that does something similar to this?
 
This does not work, it populates the combo box with only the select statement
Could you please post your ACTUAL REAL code doing that ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

I used the code you gave me below, I put it in an on click event of a command button, when I click the button it chnages the combo box to have the select statement in the combo, not the actual values.

If I use the code I posted in a previos message on this thread without the loop it works fine, but only adds the first value found and then stops of course.

Your code was used below:

If Me.cmbdatephase.Value = "January" Or Me.cmbdatephase.Value = "February" Or Me.cmbdatephase.Value = "March" Or Me.cmbdatephase.Value = "April" Or Me.cmbdatephase.Value = "May" Or Me.cmbdatephase.Value = "June" Or Me.cmbdatephase.Value = "July" Or Me.cmbdatephase.Value = "August" Or Me.cmbdatephase.Value = "September" Or Me.cmbdatephase.Value = "October" Or Me.cmbdatephase.Value = "November" Or Me.cmbdatephase.Value = "December" Then
cmbowners.RowSource = "SELECT txtidowner FROM NSAPLOG WHERE initialreviewphase='" & cmbdatephase.Value & "'"
Else
MsgBox "Please select a Month to review."
End If


 
With Me!cmbowners
.RowSourceType = "Table/Query"
.RowSource = "SELECT txtidowner FROM NSAPLOG WHERE initialreviewphase='" & cmbdatephase.Value & "'"
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
i got it working with my original code, something was wrong with the feild values.

now I just need to remove the duplicates from the combo box.
 
With Me!cmbowners
.RowSourceType = "Table/Query"
.RowSource = "SELECT [!]DISTINCT[/!] txtidowner FROM NSAPLOG WHERE initialreviewphase='" & cmbdatephase.Value & "'"
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top