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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting the selected value in combobox

Status
Not open for further replies.

axslearnr

Technical User
Apr 1, 2004
78
US
Hi
I have three comboboxes which have different values and one command button.i select the item from one of the combobox and press command button to open its correspodning report. but when i come back the item is still selected in the combobox and if i select other item in the second combobox and press command button it still opens the previous report bcos the item is till selected in it.
how to deselect it and run only one combox at a time and clear the values selected?

i wrote this code for it doesnt work


If IsNull(Me.cmbClient_ID.Column(0)) = False And Me.cmbClient_ID.Column(0) <> "" Then
DoCmd.OpenReport ReportName:=stDocName, View:=acPreview, Wherecondition:="OOS.Client_ID1 = " & cmbClient_ID.Column(0) & " or OOS.Client_ID2= " & cmbClient_ID.Column(0) & " "
rst.Close
Me!cmbClient_ID.Column(0) = ""
End If

If IsNull(Me.cmbAnalyst_ID.Column(0)) = False And Me.cmbAnalyst_ID.Column(0) <> "" Then
DoCmd.OpenReport ReportName:="OOSAnalyst", View:=acPreview, Wherecondition:="OOS.Analyst1_ID = " & cmbAnalyst_ID.Column(0) & " or OOS.Analyst2_ID= " & cmbAnalyst_ID.Column(0) & " "
rst.Close
Me!cmbAnalyst_ID.Column(0) = ""
End If

If IsNull(Me.cmbSample_Number.Column(0)) = False And Me.cmbSample_Number.Column(0) <> "" Then
DoCmd.OpenReport ReportName:="OOSSampleNumber", View:=acPreview, Wherecondition:="OOS.OOS_ID = " & cmbSample_Number.Column(0) & " or OOS.OOS_ID= " & cmbSample_Number.Column(0) & " "
rst.Close
Me!cmbSample_Number.Column(0) = ""
End If


psl help me

thank you



 
To "deselect" have you tried something like this?
Me.cmbComboName.SetFocus
Me.cmbComboName.ListIndex = -1

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
hi
thank you for your propmpt reply.i have tried that it doesnt work.pls let me know

thank you

 
Hi axslearnr,

You're making it more complex than you need; don't try setting individual columns, just the combo value ..

Code:
[blue]Me!cmbAnalyst_ID = ""[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top