If Statement Question

D

DS

I'm using the if statement below and I have 2 questions. The first is,
on the Else: part I'm making a new record, salesID but if no menus are
setup and the if statement stops, what happens to that record? And what
happens to the form Buttons? Also at the end of this if statement
whenever Menus does open up and the list has more than 2 menus, even
though Buttons is open as a hidden form it never shows up once I click
on the menu.

Thanks for your help.
DS



Private Sub Command17_Click()
If IsNull(CussName) Then
Forms!BarTab.Visible = False
DoCmd.OpenForm "NoTabName"
Else:
DoCmd.GoToRecord , , acNewRec
Me.PName = Me.CussName
DoCmd.RunCommand acCmdSaveRecord
Me.Text103 = Nz(DMax("[SalesID]", "Sales"), 0) + 1
CurrentDb.Execute "INSERT Into
Sales(SalesID,CustomerNum,SalesServer,TableNumber,Guests,SalesTax,CheckType)
VALUES(" & Me.Text103 & "," & Me.CustomerID & "," & Me.CServer & "," & 6
& "," & 1 & "," & Me.CTax & "," & 7 & ")"
DoCmd.Close acForm, "Tables"
DoCmd.OpenForm "Buttons", acNormal, , "[SalesID]=" & Me.[Text103],
, acHidden
Forms!Buttons!BText140 = Me.CLocation
Forms!Buttons!List215.Visible = False
Forms!Buttons!Text83 = Me.CussName
Me.CussName = Null
DoCmd.Close acForm, "BarTab"
DoCmd.OpenForm "Menus"
If Forms!Menus!ListMenu.ListCount = 1 Then
Forms!Menus!ListMenu.Selected(0) = True
Forms!Buttons!List215.Visible = False
Forms!Buttons!List52 = ""
Forms!Buttons.Visible = True
DoCmd.RunCommand acCmdSaveRecord
ElseIf Forms!Menus!ListMenu.ListCount = 0 Then
DoCmd.Close acForm, "Menus"
DoCmd.OpenForm "NoMenus"
ElseIf Forms!Menus!ListMenu.ListCount > 1 Then
Forms!Menus.Visible = True
Forms!Buttons!List215.Visible = False
Forms!Buttons!List52 = ""
Forms!Buttons.Visible = True
DoCmd.RunCommand acCmdSaveRecord
End If
End If
 

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