On Focus Open Form???? (1 Viewer)

Hydra427

Registered User.
Local time
Yesterday, 19:55
Joined
Mar 9, 2012
Messages
40
I have a "Master Form" where I enter models onto a table. I also have a text box on that form that (on focus) it opens another form showing all the "regular wheel boxes" that are available for that model. I would like to set this up so that (on focus) it will open the "regular wheel boxes" form when the "catagory" for the model is set to "regular wheel" if the "catagory" field shows "yesteryear" then I want it to open the "Yesteryear boxes" form. I know this might be a little confusing but to break it down:

Master Form - Catagory = Regular Wheel (text box on focus opens Regular Wheel Box Form)

Master Form - Catagory = Yesteryear (text box on focus opens Yesteryear Box Form)

Master Form - Catagory = Superfast (text box on focus opens Superfast Box Form)

I have a few more catagories but this should get you the gist of what I am trying to do.

Thanks, John
 

John Big Booty

AWF VIP
Local time
Today, 09:55
Joined
Aug 29, 2005
Messages
8,263
You could use a Case statement to do this, something along the lines of;
Code:
Dim strFormName As String

Select Case Me.Catagory 

Case "Regular Wheel"
     strFormName = "FormYouWishToOPenRegular Wheel"

Case "Yesteryear"
     strFormName = "FormYouWishToOPenYesteryear"

Case "Superfast"
     strFormName = "FormYouWishToOPenSuperfast"

Case Else
     strFormName = "FormYouWishToOPenElse"

End Select

DoCmd.OpenForm strFormName
 

Hydra427

Registered User.
Local time
Yesterday, 19:55
Joined
Mar 9, 2012
Messages
40
John, This solution works great, I have a catagory called "catalog", since a catalog doesn't have a box, is it possible to set it so that it doesn't open a form when the catagory is set to "catalog"?
 

John Big Booty

AWF VIP
Local time
Today, 09:55
Joined
Aug 29, 2005
Messages
8,263
Try something like;
Code:
Dim strFormName As String

Select Case Me.Catagory 

Case "Regular Wheel"
     strFormName = "FormYouWishToOPenRegular Wheel"

Case "Yesteryear"
     strFormName = "FormYouWishToOPenYesteryear"

Case "Superfast"
     strFormName = "FormYouWishToOPenSuperfast"

Case "catalog"
     MsgBox "No Form for Category Catalog"
     Exit Sub 

Case Else
     strFormName = "FormYouWishToOPenElse"

End Select

DoCmd.OpenForm strFormName
 

Users who are viewing this thread

Top Bottom