Eljefegeneo
Still trying to learn
- Local time
- Yesterday, 18:56
- Joined
- Jan 10, 2011
- Messages
- 902
I have a simple popup form that I want to use to send emails from my main database. Please see the attached sample DB. If I open the frmEmails directly the header appears. But if I open it from frmNames, (along with code to populate a new record) the header disappears.
I think I have check all the properties and nothing seems amiss. I even tried to force the header property to be visible on form load,
but that doesn't help either.
Have done an extensive search about this problem. The only similar post that I could find suggested to use the following:
But, that doesn't seem to help either.
So I am thinking that there is something in my code in the command button that is causing the problem. So I created another command button on frmNames "frmEmails2" that would bring up frmEmails but without the underlying code to force a new record and populate the fields as I wanted. The header now appears.
Question: What am I doing wrong? Why can't I use the first button "frmEmails" and have the header appear.
Code:
Private Sub cmdEmail_Click()
Dim PST, Toa, Cid As String
Cid = ClientID
PST = Client
Toa = Email
DoCmd.OpenForm "frmEmails", , , acFormAdd
If Not IsNull(PST) Then
Forms!frmEmails.PersonSentTo = PST
End If
If Not IsNull(Toa) Then
Forms!frmEmails.To = Toa
End If
Forms!frmEmails.ClientID = Cid
End Sub
Code:
Me.FormHeader.Visible = True
Have done an extensive search about this problem. The only similar post that I could find suggested to use the following:
Code:
Dim ctrl As Control
For Each ctrl In Me.Section(acHeader).Controls
ctrl.Visible = ctrl.Visible
Next
So I am thinking that there is something in my code in the command button that is causing the problem. So I created another command button on frmNames "frmEmails2" that would bring up frmEmails but without the underlying code to force a new record and populate the fields as I wanted. The header now appears.
Question: What am I doing wrong? Why can't I use the first button "frmEmails" and have the header appear.