JWColby
jwcolby at colbyconsulting.com
Mon Feb 12 15:35:32 CST 2007
Let me get this straight, the opening form is bound, the controls are bound, but when the form finishes opening it doesn't display the right data? Is it possible that the opening form is pulling a recordset with more than one record, and the values "pulled in" are not for the record currently being displayed? Why would you set the values in bound controls if the form is going to display the record anyway? Just open the form, tell it to display the specific record being displayed back on the other form, and be done with it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at Beach Access Software Sent: Monday, February 12, 2007 4:21 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Data Not Displaying in Text and Combo Boxes 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com