Hello there,
I have a very strange problem:
I have three forms and a query:
- [frmMain] has [lstDesig].
- When "btnOK" is clicked [frmUserData] opens up
- [frmUserData] has [txtOperator]
- when form is loaded [txtOperator] shows the selection made in [frmMain]![lstDesign] originally with the following code written in the control source field using the expression builder [Forms]![frmMain]![lstDesig] & ""
- [Qry-Designations] has columns [Station] and [Assigned].
- The [Assigned] column has the following formula in the criteria field written with the expression builder so that query is filtered [forms]![frmUserData]![txtOperator]
- [frmUserData] has also [lstStation] which shows the data in [Station] of [Qry-Designations]. This is the code in the Row Source field SELECT [Qry-Designations].Station FROM [Qry-Designations];
Everything works just fine so far, but I added a new form [frmSearch] which has [cboEmployee], I have been all day trying to alternate the information written in [frmMain]![txtOperator] so that if [frmSearch].IsLoaded then pulls data from [frmSearch]![cboEmployee] Else [frmMain]![lstDesig] and I have the code working well which is the following:
Code:
Private Sub Form_Load()
If CurrentProject.AllForms("frmSearch").IsLoaded Then
Me.txtOperator = Forms!frmSearch.cboEmployee
Else
Me.txtOperator = Forms!frmMain.lstDesig
End If
The rare issue here is that, when I click "btnOK" in [frmMain], the form [frmUserData] is correctly open and [txtOperator] is correctly filled with the selection at [lstDesig] but [lstStation] doesn't show the data from the query, the thing is that I changed the form to design view to verify formulas and without changing anything I changed it back to form view and then the data appeared in the listbox! I repeated this a few times, I even closed the file and reopened it and it does that every time. I erased the VBA code of [txtOperator] and wrote again the code it had in the control source field and then it works normal, then I tested the formula Me.txtOperator = Forms!frmMain.lstDesig by itself and it does it again, the same, not showing at first but then showing it after switching back from design view... I find this very odd and can't even imagine what could be happening, I also tried refreshing the form without going into design view but had no success...I'd really appreciate any feedback here
thanks