Why doesn't this work!!??

  • Thread starter Thread starter Tony Vrolyk
  • Start date Start date
T

Tony Vrolyk

I am scratching my head. This seems so simple but I just can't get it to
cooperate.

On one form (MainForm) there are so many controls there is no room on screen
to display some controls. I do not want to use a tab control. I have an
unbound pop up form (PopUp) that displays values from those controls.

Controls on PopUp are populated OnOpen from controls on MainForm. When
closing I check the value of each control on PopUp against the corresponding
control on MainForm and if different set control on MainForm to match the
one on PopUp. This way values on MainForm are not updated unnecessarily and
therefore triggering the BeforeUpdate event.

OnClick of the close button or PopUp, I use the code below to update the
controls on MainForm.

If I put in a MsgBox that displays the value of the controls on PopUp and
MainForm, they appear different, but for some reason the If statement below
will
not evaluate correctly for text boxes and combo boxes and does not update
the control on MainForm. It works fine for Check boxes. I am scratching my
head as to why. I am probably just tired.

'Code start - This code is repeated for 13 controls on PopUp.
If Forms!Plans!AdoptionAgreementDate <> Me.AdoptionAgreementDate Then
Forms!Plans!AdoptionAgreementDate = Me.AdoptionAgreementDate
End If
'Code End

BTW -
MainForm is set to AllowEdits
Controls on MainForm are invisible, enabled
and unlocked. (visible during testing)
Controls on MainForm are commonly Null to begin with.
PopUp form is Modal


Can you help?
Thanks
Tony Vrolyk
 
Tony Vrolyk said:
I am scratching my head. This seems so simple but I just can't get it to
cooperate.

On one form (MainForm) there are so many controls there is no room on screen
to display some controls. I do not want to use a tab control. I have an
unbound pop up form (PopUp) that displays values from those controls.

Controls on PopUp are populated OnOpen from controls on MainForm. When
closing I check the value of each control on PopUp against the corresponding
control on MainForm and if different set control on MainForm to match the
one on PopUp. This way values on MainForm are not updated unnecessarily and
therefore triggering the BeforeUpdate event.

OnClick of the close button or PopUp, I use the code below to update the
controls on MainForm.

If I put in a MsgBox that displays the value of the controls on PopUp and
MainForm, they appear different, but for some reason the If statement below
will
not evaluate correctly for text boxes and combo boxes and does not update
the control on MainForm. It works fine for Check boxes. I am scratching my
head as to why. I am probably just tired.

'Code start - This code is repeated for 13 controls on PopUp.
If Forms!Plans!AdoptionAgreementDate <> Me.AdoptionAgreementDate Then
Forms!Plans!AdoptionAgreementDate = Me.AdoptionAgreementDate
End If
'Code End

BTW -
MainForm is set to AllowEdits
Controls on MainForm are invisible, enabled
and unlocked. (visible during testing)
Controls on MainForm are commonly Null to begin with.

There's your answer. You cannot make a comparison to Null. Try...

If Nz(Forms!Plans!AdoptionAgreementDate,"") <>
Nz(Me.AdoptionAgreementDate,"") Then...

Care to say why you don't want to use a TabControl? You can set the style
to "None" and control the page display from a button or other code in which
case it would act much like what you're doing now except it would be a lot
simpler since the user would be typing in normal bound controls and you
eliminate the second form completely.
 
Back
Top