Can I make my form close automaticlly after I choose a command button from it
Auto closing
Collapse
X
-
I am running a CodeOriginally posted by mshmyobAre you running a MACRO or CODE?
I'm making a quiz maker using Access
I'm putting in switchboard (Open Quiz) so a form will open to ask if I want ANSWERS or QUESTIONS (the report will open)
I want after pressing one of these buttons to close the form automatically (which ask ANS or Que)Comment
-
Could you not just put this code into the OnOpen event of the report?Originally posted by tawjawI am running a Code
I'm making a quiz maker using Access
I'm putting in switchboard (Open Quiz) so a form will open to ask if I want ANSWERS or QUESTIONS (the report will open)
I want after pressing one of these buttons to close the form automatically (which ask ANS or Que)
[CODE=vb]
DoCmd.Close acForm, "FormName",acSa veNo
[/CODE]Comment
-
Post in the code you currently have for your que_Click Command Button, then I can tell you where to put the extra line. Essentially it's as you said - at the end.Originally posted by tawjawThis is my command button name: que_Click
were should I replace it in the code
thx for helping
If you post it though I can show you exactly where. Please remember to use the [ CODE ] tags provided of course.Comment
-
The code for que_Click isOriginally posted by NeoPaPost in the code you currently have for your que_Click Command Button, then I can tell you where to put the extra line. Essentially it's as you said - at the end.
If you post it though I can show you exactly where. Please remember to use the [ CODE ] tags provided of course.
The form name is: QuizCode:Private Sub que_Click() On Error GoTo Err_que_Click Dim stDocName As String stDocName = "Questions" DoCmd.OpenReport stDocName, acPreview Exit_que_Click: Exit Sub Err_que_Click: MsgBox Err.Description Resume Exit_que_Click End SubComment
-
You need it after line #7 then :
It would need to be in a similar place for the other Command Button too.Code:Private Sub que_Click() On Error GoTo Err_que_Click Dim stDocName As String stDocName = "Questions" DoCmd.OpenReport stDocName, acPreview Call DoCmd.Close(ObjectType:=acForm, ObjectName:=Me.Name) Exit_que_Click: Exit Sub Err_que_Click: MsgBox Err.Description Resume Exit_que_Click End SubComment
-
Thanks a lot it worked.Originally posted by NeoPaYou need it after line #7 then :
It would need to be in a similar place for the other Command Button too.Code:Private Sub que_Click() On Error GoTo Err_que_Click Dim stDocName As String stDocName = "Questions" DoCmd.OpenReport stDocName, acPreview Call DoCmd.Close(ObjectType:=acForm, ObjectName:=Me.Name) Exit_que_Click: Exit Sub Err_que_Click: MsgBox Err.Description Resume Exit_que_Click End Sub
I'm still new with Access and I never learned Visual Basic language
However I'm still 14Comment
Comment