Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Mon Feb 12 15:21:22 CST 2007
Dear List:
I call form from another form and in the open event of the called form, if
the calling form is open (the called form could also be opened from the
switchboard as well), I insert the values into the called form from the
calling form:
If CurrentProject.AllForms("frmWorkDetail").IsLoaded Then
Me.cboEmployer = Forms!frmWorkDetail!cboEmployer.Column(0)
Me.txtEmployer = Forms!frmWorkDetail!txtEmployer
Me.cboMonth = Forms!frmWorkDetail!cboWorkMonth
Me.cboYear.Value = Forms!frmWorkDetail!cboWorkYear
Me.cboClass = Forms!frmWorkDetail!cboClass.Column(0)
Me.cboEntryMonth = Forms!frmWorkDetail!cboEntryMonth
Me.cboEntryYear = Forms!frmWorkDetail!cboEntryYear
Me.txtEmployerID = Forms!frmWorkDetail!txtEmployerID
End If
then base the form's record source on those parameters:
Me.RecordSource = "Select * FROM tblAdjustment WHERE " _
& "fldEmployerID = " & Val(Me.txtEmployerID) & " AND fldClassID = " _
& Me.cboClass.Column(0) & " AND fldAdjustmentMonth = " &
Me.cboMonth.Column(0) _
& " AND fldAdjustmentYear = " & Me.cboYear & " AND
fldAdjustmentEntryMonth = " _
& Me.cboEntryMonth.Column(0) & " AND fldAdjustmentEntryYear = " &
Me.cboEntryYear
It's working fine except for one thing - the passed values are not displayed
in the text and combo boxes. But they are there because the modified record
source gets the right records. And I even displayed Me.RecordSource in a
MsgBox and it was correct.
Here's the weird part (meaning SOP for Access) - if I alt-Tab away from the
form then alt-Tab back, the values appear in the text and combo boxes. I
tried adding a repaint before the End If but no soap.
Any ideas?
MTIA,
Rocky