HOW CAN I DO THIS?

H

HANA

I HAVE AN Access projcet full with forms, i want a code that close all the
form that i opend

i tryed the End code & unload, but ithenk there is somthing missing

thanks for any help
 
K

krzysztof via AccessMonster.com

you would need to be a bit more precise, but i think you are looking for a
quit operation. can you provide me more details?
 
C

chris.nebinger

Would Application.Quit work for you?

End Code & Form.Unload are VB6 commands. Access does not support them.


Chris Nebinger
 
H

HANA

HI
my project is a bout Pharmacy & contain more than 8 forms the baisc form
contain 3 command button 2 of them are concted with forms by siting there
propartis to open them, the last one is to Exit i also set itis propartis to
close but it's only colsing the the baisc form, i want this button to colse
all the forms
 
S

Steve Schapel

HANA,

If you mean you want to close all open forms, but leave the database
open, code something like this?...

Dim i As Integer
For i = Forms.Count - 1 To 0
DoCmd.Close acForm, Forms(i).Name
Next i
 
H

HANA

HI Steve
thank you for repling & sorry for beaing lait, i tried the code that you
gived me but is not working & put it here:
Private Sub Exit_Click()
On Error GoTo Err_Exit_Click
Dim i As Integer
For i = Forms.Count - 1 To 0
DoCmd.Close acForm, Forms(i).Name
Next i


DoCmd.Close

Exit_Exit_Click:
Exit Sub

Err_Exit_Click:
MsgBox Err.Description
Resume Exit_Exit_Click

End Sub
is that corrcet?
thanks for help:)
 
S

Steve Schapel

HANA,

Since we are counting backwards, try it by putting the Step argument in,
like this...

Dim i As Integer
For i = Forms.Count - 1 To 0 Step -1
DoCmd.Close acForm, Forms(i).Name
Next i
 
H

HANA

HI Mr.Steve
thank you for helping it worked for me i found that i missed(step-1)
i want to ask you one more Q?

it's normally in Access form we see navigations buttons in the end of the
form can we hide them? & make them spirited by putting them in box

thank you
 
D

Douglas J. Steele

Forms have a NavigationButton property you can set False (No) if you don't
want to see the navigation buttons.
 
Top