[AccessD] Data Not Displaying in Text and Combo Boxes

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Mon Feb 12 16:38:21 CST 2007


Not quite.  The calling form is bound but the values in the calling form
that are being passed are unbound.  They are in the header and are used to
filter data on that form as well as to create records in the table that IS
bound to the calling form. 

In the called form the user enters and edits dollar adjustments (to payroll
numbers).  The called form can either be opened from a command button on the
calling form, or from the main menu (switchboard).

When the user opens the adjustments from from the main menu, they select the
parameters they want.  But when the adjustment form opens from the calling
form, those six parameters are already selected in the calling form.  So
instead of having them re-enter those six parameters, they want them to be
passed to the called form so everything is set up to enter the adjustments.

So the bit of code down there starting with If
CurrentProject.AllForms("frmWorkDetail").IsLoaded Then does that.  And it
works.

The only problem is that the values are not displayed in the unbound boxes
on the called form (you can think of these unbound boxes on both forms as
filters, I guess).

If I do alt-Tab to another open window, and the alt-Tab back, the value are
now displayed.  The values are there because I monitored the creation of the
called form's Record Source based on those values, drawn from the unbound
text boxes (and combo boxes) and the values are there.  Just not showing in
the form.

I'm doing this work, BTW, in the Open event of the called form.  Maybe I
should move it to the Load event?

Hey!  I just tried that.  Moved the code from the Open event to the Load
event and it worked!  Thanks for kick starting the old branium.

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Monday, February 12, 2007 1:36 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Data Not Displaying in Text and Combo Boxes

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

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.36/681 - Release Date: 2/11/2007
6:50 PM
 




More information about the AccessD mailing list