troubleshooting Question

MS Access Refer To Form With String Value

Avatar of Dustin Stanley
Dustin Stanley asked on
Microsoft AccessVBA
7 Comments1 Solution91 ViewsLast Modified:
I am needing to use the same Code for multiple situations but I can not figure out one part. Here is a example:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'LETS SEE WHICH CHECKOUT FORM IS OPEN SO WE CAN FILL IT OUT PROPERLY
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Dim CheckoutFormName As String
 Dim Receipt As String
 
If CurrentProject.AllForms("frmNewOrdersGuestCheckout").IsLoaded = True Then ' Guest Checkout Form is Open
CheckoutFormName = "frmNewOrdersGuestCheckout"
Receipt = "RptqryGuestCheckoutReceipt"
End If

If CurrentProject.AllForms("frmNewOrder").IsLoaded = True Then   ' Customer with account Form is Open
CheckoutFormName = "frmNewOrder"
Receipt = "RptqryCheckoutReceipt"
End If

Forms!CheckoutFormName!OrderStatusID = "7"


Now for the line Forms!CheckoutFormName!OrderStatusID = "7" how would I set it up to get Access to find and accept the the String (CheckoutFormName) as a form?

Thank you for the help.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros