abenitez77
Registered User.
- Local time
- Yesterday, 19:34
- Joined
- Apr 29, 2010
- Messages
- 141
I have a form that has a listbox. I am calling a procedure from a module and then it closes my form and reopens it. I want my listbox to keep the same location, in other words the selected value will be the same so that it does not loose it's place. Below was my attempt to do this. I get an error msg that What I am doing with ListIndex is not allowed....
Dim LI As Long
Forms("ReportManager")("lstReportName").SetFocus
LI = Forms("ReportManager")("lstReportName").ListIndex
Call ApplyFields(LI)
Sub ApplyFields(ListIdx as long)
DoCmd.Close acForm, "ReportManager", acSaveYes
DoCmd.OpenForm "ReportManager"
Forms("ReportManager")("lstReportName").SetFocus
Forms("ReportManager")("lstReportName").ListIndex = ListIdx
End Sub
Dim LI As Long
Forms("ReportManager")("lstReportName").SetFocus
LI = Forms("ReportManager")("lstReportName").ListIndex
Call ApplyFields(LI)
Sub ApplyFields(ListIdx as long)
DoCmd.Close acForm, "ReportManager", acSaveYes
DoCmd.OpenForm "ReportManager"
Forms("ReportManager")("lstReportName").SetFocus
Forms("ReportManager")("lstReportName").ListIndex = ListIdx
End Sub