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. Is there 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:
Back is a variable: Dim Back as string
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"
ElseIf sbfUnbound.SourceObject = "frmReceivables" Then
Back = "frmReceivables"
ElseIf sbfUnbound.SourceObject = "frmSales" Then
Back = "frmSales"
End If
sbfUnbound.SourceObject = "frmCustomerLookup"
End Sub
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 of when they were brought upv? any help would be greatly apreciated.
The "Back" Button:
Back is a variable: Dim Back as string
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"
ElseIf sbfUnbound.SourceObject = "frmReceivables" Then
Back = "frmReceivables"
ElseIf sbfUnbound.SourceObject = "frmSales" Then
Back = "frmSales"
End If
sbfUnbound.SourceObject = "frmCustomerLookup"
End Sub
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 of when they were brought upv? any help would be greatly apreciated.