Problem closing a form

DJ_DEF_CON_1

Registered User.
Local time
Today, 00:49
Joined
Jan 1, 2003
Messages
40
I have some code that is getting stuck. Could someone please look at the following and see if they can figure out what is wrong.
The form "KYLE" just displays when the user has to exit the form.
Any help would be greatly appreciated.

Private Sub Form_Timer()
Dim ETIME
ETIME = DateDiff("n", [TIME_OPEN], Now())
If ETIME > 15 And ETIME < 30 Then
DoCmd.OpenForm "KYLE"
Else
If ETIME > 29 Then
DoCmd.Close
DoCmd.Close "KYLE" IT IS GETTING STUCK HERE!
DoCmd.OpenQuery "qryDeleteInfo"
End If
End If
End Sub
 
Assuming

DateDiff("d", Now, TheDate)


Private Sub Form_Timer()
Dim ETIME as Integer

Set ETIME = DateDiff("n", [TIME_OPEN], Now())

If ETIME > 15 And ETIME < 30 Then
DoCmd.OpenForm "KYLE"
ElseIf ETIME > 29 Then
DoCmd.Close "KYLE" IT IS GETTING STUCK HERE!
DoCmd.OpenQuery "qryDeleteInfo"
Else
End If
End Sub
 
Thanks for your assistance. I am however; a little confused. What do you mean by "Assuming DateDiff("d", Now, TheDate). Where would I put that. I am new to code.

What I am having trouble understanding is why the one form closes but not "KYLE"

No matter what we try we cannot get it to close through code.

Any futher information would be helpful.

Thank You

The error is a type mismatch error :confused:
 
Last edited:
ETIME = DateDiff("n", [TIME_OPEN], Now())
If ETIME > 15 And ETIME < 30 Then
DoCmd.OpenForm "KYLE"
Else
If ETIME > 29 Then
DoCmd.Close
DoCmd.Close "KYLE"
DoCmd.OpenQuery "qryDeleteInfo"
End If
End If
End Sub

What I'm trying to do is, if ETIME is greater than 15 minutes but less that 30 minutes , then I want it to open the form "KYLE". Then later, if ETIME is greater than 29 minutes. I want it to close the form they are in and the form "KYLE". I keep getting a type mismatch error on DoCmd.Close "KYLE"
This is where I am getting stuck.
 

Users who are viewing this thread

Back
Top Bottom