CourteJester
New member
- Local time
- Today, 11:04
- Joined
- Sep 14, 2004
- Messages
- 7
On my main form i have an Unbound subform that allows me to have any of my other forms in there when i want. The problem i am having is i just put in a "Back" button, and i am not sure if i am doing the logic corect or if there is an easier way to do this. it works, sorta (it only goes back to one subform). Here is the code for the buttons i have (should i use selectcase instead of if statements):
The "Back" Button:
Private Sub cmdBack_Click()
If sbfUnbound.SourceObject = "" Then
MsgBox "You cannot go back.", vbInformation, "Unable to go back."
Else
sbfUnbound.SourceObject = Back
End If
The other buttons that get the Subforms to appear have this example of code:
Private Sub cmdCustomerLookup_Click()
If sbfUnbound.SourceObject = "" Then
Back = "frmCustomerLookup"
ElseIf sbfUnbound.SourceObject = "frmOrder" Then
Back = "frmOrder"
End If
sbfUnbound.SourceObject = "frmCustomerLookup"
End Sub
Back is a variable: Dim Back as string
i know this will only go back one subform. anythoughts on how i could have it store all the subforms it has gone through so i am able to go backwards or forwards in order? any help would be greatly apreciated.
The "Back" Button:
Private Sub cmdBack_Click()
If sbfUnbound.SourceObject = "" Then
MsgBox "You cannot go back.", vbInformation, "Unable to go back."
Else
sbfUnbound.SourceObject = Back
End If
The other buttons that get the Subforms to appear have this example of code:
Private Sub cmdCustomerLookup_Click()
If sbfUnbound.SourceObject = "" Then
Back = "frmCustomerLookup"
ElseIf sbfUnbound.SourceObject = "frmOrder" Then
Back = "frmOrder"
End If
sbfUnbound.SourceObject = "frmCustomerLookup"
End Sub
Back is a variable: Dim Back as string
i know this will only go back one subform. anythoughts on how i could have it store all the subforms it has gone through so i am able to go backwards or forwards in order? any help would be greatly apreciated.
Last edited: