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

problem with dorpdown combos

Status
Not open for further replies.

Sohailaziz

Programmer
May 13, 2005
9
GB
hi there,

I got a unbound form, which got 4 unbound combos.

1. ApplicationCombo
2. FolderCombo
3. SubFolderCombo
4. ReportCOmbo

ApplicationCombo is filled in the beforeupdate event.
FolderCmbo is filled with data on the afteraupdate event of Application Combo.

The AfterUpdate event of folder combo fill in the SubfolderCombo and also ReportCombo. (its possible to have reports in in main folders).

IF you click on the Subfolder and make a selection,the afterupdate event will clear the Reportcombo by
me.Reportcombo.rowsource=""
me.reportcombo=null

then fill it with list of reports within that subfolder.
ALL this is working fine...

the Problem is .... let say the ReportCOmbo got 6 values.(names of reports). no matter which ever u select by clickin them in the dropdown list, it shows the frist value selected.

i dont know how to solve the problem. Please help.

Regards ....

 
Do you mean the report names repeate in the combo and the first instance is stored regardless of the one you select?

Access sometimes get tripped up when the display values in a combobox are not distinct. The solution is to use something that is unique.

Otherwise, can you be more specific about the details of the combobox and what is happening.
 
ok let me explain in a bit detail whats going on ....

the ReportCombo settings are
ColumnCount=2
Columnbound=1
Columnwidth=0cm;6cm

when i click on it, its displays the following data... (please remmember the numbering is just for you, its not used in the combo)

number Code, ReportName
1. 20 Accounts KPI
2. 23 Accounts Statistics
3. 28 SubAccounts details
4. 30 all categories

now let say if i select number 3, which is

Code=3 and ReportName=SubAccounts Details

It shows Code=20 and ReportName=Accounts KPI

No matter whatever i select, it will show me

It shows Code=20 and ReportName=Accounts KPI

in the afterUpdate event of the ReportCombo i just put in

Msgbox me.reportcombo.column(0)

every time i get the value 20 only... its dont change at all....



 
On ReportCombo do you have any other events... maybe a before update event that is cancelling the input?
 
hi sorry for delay in reply.

no i dont have any events on the reportcombo. its behaviour changes after i load data into it by selection from the other combos.

this is the code for foldercombo and subfoldercombo where i populate the reportcombo..


Private Sub FolderCombo_AfterUpdate()
On Error GoTo Err_fcmobo_Click
Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim srtqry As String

ReportCombo.RowSource = ""
ReportCombo.Value = Null
SubFolderCombo.RowSource = ""
SubFolderCombo.Value = Null

rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
strqry = "SELECT RTname.LinkedFolder_ID,RTName.description_vc from " & _
" ICT_Reports_ReportName_T (nolock) RTName " & _
" where (RTname.expiry_date_dt>getdate() or RTname.expiry_date_dt is null) " & _
"and RTname.LinkedFolder_ID ='" & FolderCombo.Column(0) & "' order by 1;"

rsData.Open (strqry)

Do While Not rsData.EOF
ReportCombo.RowSource = ReportCombo.RowSource & rsData(0) & ";" & rsData(1) & ";"
rsData.MoveNext
Loop

rsData.Close

'----------------------SubFolder script

rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
strqry = "SELECT sct.code_ID,sct.description_vc from Shared_Codes_T (nolock) sct " & _
" where sct.Type_ID = 5 and sct.posting_code_vc ='" & FolderCombo.Column(0) & "'order by 1;"

rsData.Open (strqry)

Do While Not rsData.EOF
SubFolderCombo.RowSource = SubFolderCombo.RowSource & rsData(0) & ";" & rsData(1) & ";"
rsData.MoveNext
Loop

rsData.Close
Set rsData = Nothing


Exit_fcmobo_Click:
Exit Sub

Err_fcmobo_Click:
MsgBox Err.Description
Resume Exit_fcmobo_Click

End Sub








Private Sub SubFolderCombo_AfterUpdate()
On Error GoTo Err_SFcmobo_Click

Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim srtqry As String

ReportCombo.RowSource = ""
ReportCombo.Value = Null

rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
strqry = "SELECT RTname.LinkedFolder_ID,RTName.description_vc from " & _
" ICT_Reports_ReportName_T (nolock) RTName " & _
" where (RTname.expiry_date_dt>getdate() or RTname.expiry_date_dt is null) " & _
"and RTname.LinkedFolder_ID ='" & SubFolderCombo.Column(0) & "' order by 1;"

rsData.Open (strqry)

Do While Not rsData.EOF
ReportCombo.RowSource = ReportCombo.RowSource & rsData(0) & ";" & rsData(1) & ";"
rsData.MoveNext
Loop

rsData.Close
Set rsData = Nothing

Exit_SFcmobo_Click:
Exit Sub

Err_SFcmobo_Click:
MsgBox Err.Description
Resume Exit_SFcmobo_Click

End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top