Checking a Status Control from a Form Before Proceeding2

A

Ange Kappas

Hi All,
In my previous Post, I asked for some help concerning a VBA
Code for a proceedure in my small program. After working on it for a bit and
testing I managed to progress it a little bit which seems to work but I need
it to quit after the lines where it says:

DoCmd.OpenForm "DEPARTURES" or

DoCmd.OpenForm "MAIN MENU"

and not to proceed to the following lines since I have to proceed with
placing the departures from IN to OUT.

How do I do that.

Help will be appreciated !!!

Thanks
Ange


Private Sub Toggle8_Click()
Dim PoseidonHotelProgram As Database
Dim rsta As DAO.Recordset
Dim frm As Form
Dim Msg, Style, Title, Response, MyString

Set db1 = CurrentDb()
Set Myset5 = db1.OpenRecordset("qryDEPARTURES")

If Myset5![STATUS] = "IN" Then
Msg = "THERE ARE STILL DEPARTURES PENDING!"
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Define buttons.
Title = "DEPARTURES PENDING" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
DoCmd.OpenForm "DEPARTURES"
Else

MyString = "No" ' Perform some action.
DoCmd.OpenForm "MAIN MENU"

End If


Msg = "CONFIRM CLOSE DAY YES to Continue NO to Change/Edit Transaction ?"
' Define message.
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Define buttons.
Title = "FINALIZE CLOSE DAY" ' Define title.

Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.


MyString = "Yes" ' Perform some action.

Set Myset = db1.OpenRecordset("TODAY CHARGES")
Set Myset2 = db1.OpenRecordset("RESPEL ALL CHARGES")
Set Myset4 = db1.OpenRecordset("RUNDATE")


With Myset
If Not .EOF Then
.MoveFirst
End If
Do While Not .EOF
Myset2.AddNew
Myset2![Date] = Myset![Date]
Myset2![PELNMB] = Myset![PELNMB]
Myset2![RESNO] = Myset![RESNO]
Myset2![RESNAME] = Myset![RESNAME]
Myset2![COMPANY] = Myset![COMPANY]
Myset2![PRICELIST] = Myset![PRICELIST]
Myset2![HOTELAPT] = Myset![HOTELAPT]
Myset2![ROOMNO] = Myset![ROOMNO]
Myset2![ROOMTYPE] = Myset![ROOMTYPE]
Myset2![BASIS] = Myset![BASIS]
Myset2![ARRIVAL] = Myset![ARRIVAL]
Myset2![DAYS] = Myset![DAYS]
Myset2![DEPARTURE] = Myset![DEPARTURE]
Myset2![SURNAME] = Myset![SURNAME]
Myset2![NAME] = Myset![NAME]
Myset2![DAILY CHARGE] = IIf(Myset![PRICELIST] = "Z", Myset![DAILY CHARGE],
Myset![Price])
Myset2.Update
..MoveNext
Loop
End With
Myset2.Close



Myset4.MoveLast
Myset4.Delete
Myset4.AddNew
Myset4![Date] = Me![NEW DATE]
Myset4.Update
Myset4.Close
Else


MyString = "No" ' Perform some action.
DoCmd.OpenForm "MAIN MENU"


End If
End If
End Sub
 
S

Stefan Hoffmann

hi Ange,

Ange said:
DoCmd.OpenForm "DEPARTURES" or
and not to proceed to the following lines since I have to proceed with
placing the departures from IN to OUT.
How do I do that.
Take a look at to DoCmd.OpenForm parameters:

DoCmd.OpenForm AFormName, , , , , acDialog

Code excution will stop as long as the form is not closed, when using
WindowMode := acDialog.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top