random popup form problems

teiben

Registered User.
Local time
Today, 10:31
Joined
Jun 20, 2002
Messages
462
I have a form that I want to Displays random messages / Tips / Reminders etc. It works (subform) except now I want to call the popup form from another form:

this is what I have:

This part doesn't work
Option Compare Database
Dim showtip As Boolean ‘Defined as Boolean so tip only displays once

Private Sub Form_Activate()
If showtip Then
showtip = False
DoCmd.OpenForm "TipofTheDay", acNormal, , , , , Me.Name ‘This open the popup
End If

End Sub

Private Sub Form_Load()
showtip = True
End Sub

The following is the foundation:
Table: Tips
3 fields TipID (autonumber); Tip (memo); Appliesto (text)

Query - RandomTip
SELECT Tip, AppliesTo
FROM Tips
ORDER BY Rnd(TipID);

Subform - TipOfTheDay
Option Compare Database
Dim caller As String
Dim smg As String

Private Sub Form_Load()
caller = ""
If Not IsNull(Me.OpenArgs) Then caller = Me.OpenArgs

msg = ""
If Len(caller) = 0 Then
msg = DLookup("Tip", "RandomTip")

Else

mgs = DLookup("Tip", "RandomTip", "AppliesTo = '" & caller & "' OR appliesto is Null")
End If

LBLTIP.Caption = String(30, " ") & "Tip of the Day" & vbCrLf & vbcrlt & msg
Me.InsideHeight = LBLTIP.Height
Me.InsideWidth = LBLTIP.Width
End Sub


Private Sub Form_Timer()
DoCmd.Close acForm, Me.Name Closes the popup
End Sub

Private Sub LBLTIP_Click()
DoCmd.Close acForm, Me.Name Closes the popup
End Sub
 

Attachments

  • Problem.JPG
    Problem.JPG
    25.6 KB · Views: 127

Users who are viewing this thread

Back
Top Bottom