Procedure with Wildcards

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon
I'm working on a small budget tracking application for my department. I have a switchboard form that, based on inputs in listboxes, is to open the 'inner' forms.

For example, the first lb contains "New", "Modify", "View" and the second contains "Vendor Company", "Vendor Contact", "Project", "Purchase Order", "Line Item", "Invoice", and "Payment". The OnClick for the GO! button is to open a form called F_XY where X is the dlookup for the first lb and Y is the value of the dlookup for the second lb

Example: If the NEW and PROJECT are both highlighted, the GO button should open a form called "F_13" (you get the idea)

Well, my OnClick is thus
Option Compare Databas
Private Sub Go_Click(
DoCmd.OpenForm ("F_" & DLookup([ActionID], "T_Action", "T_Action.Action = Forms!F_Switchboard.LB_Action") & DLookup([CategoryID], "T_Category", "T_Category.Category = Forms!F_Switchboard.LB_Category")
End Su

My F_Switchboard is unbound so there's no updating that needs to be done before the OnClick procedure runs

If someone can help me out - and I don't think I left out any information - I'd really appreciate it. I'm stumped
Thank you
Derek
 
Derek said:
Good afternoon,
I'm working on a small budget tracking application for my department. I have a switchboard form that, based on inputs in listboxes, is to open the 'inner' forms.

For example, the first lb contains "New", "Modify", "View" and the second contains "Vendor Company", "Vendor Contact", "Project", "Purchase Order", "Line Item", "Invoice", and "Payment". The OnClick for the GO! button is to open a form called F_XY where X is the dlookup for the first lb and Y is the value of the dlookup for the second lb.

Example: If the NEW and PROJECT are both highlighted, the GO button should open a form called "F_13" (you get the idea).

Well, my OnClick is thus:
Option Compare Database
Private Sub Go_Click()
DoCmd.OpenForm ("F_" & DLookup([ActionID], "T_Action", "T_Action.Action = Forms!F_Switchboard.LB_Action") & DLookup([CategoryID], "T_Category", "T_Category.Category = Forms!F_Switchboard.LB_Category"))
End Sub

My F_Switchboard is unbound so there's no updating that needs to be done before the OnClick procedure runs.

If someone can help me out - and I don't think I left out any information - I'd really appreciate it. I'm stumped.
Thank you!
Derek

Well, it may be me, but I don't really see the *question*. What do you need?

It occurs to me that you go a long way. Your listboxes can have two
columns, the second set to width=0 so it won't display and containing
the actionID you need. That shortens the OpenForm expression a bit.
 
For example, the first lb contains "New", "Modify", "View" and the second contains "Vendor Company", "Vendor Contact", "Project", "Purchase Order", "Line Item", "Invoice", and "Payment". The OnClick for the GO! button is to open a form called F_XY where X is the dlookup for the first lb and Y is the value of the dlookup for the second lb.

Example: If the NEW and PROJECT are both highlighted, the GO button should open a form called "F_13" (you get the idea).

Well, my OnClick is thus:
Option Compare Database
Private Sub Go_Click()
DoCmd.OpenForm ("F_" & DLookup([ActionID], "T_Action", "T_Action.Action = Forms!F_Switchboard.LB_Action") & DLookup([CategoryID], "T_Category", "T_Category.Category = Forms!F_Switchboard.LB_Category"))
End Sub

I think the problem is that the first argument to DLookUp must be a
*text string* containing the name of the field to be looked up - you
have the value of the field itself. Put [ActionID] and [CategoryID] in
quotes.
 
Thanks. I've gotten quite a bit more done on the project. The F_Switchboard is now done.

Now, I'm working on something different - new subject, so I'll post separately (that way, it's more searchable to others needing the same assistance)

Thanks again
Dere

----- John Vinson wrote: ----

On Wed, 25 Feb 2004 14:11:09 -0800, "Derek Wittman
For example, the first lb contains "New", "Modify", "View" and the second contains "Vendor Company", "Vendor Contact", "Project", "Purchase Order", "Line Item", "Invoice", and "Payment". The OnClick for the GO! button is to open a form called F_XY where X is the dlookup for the first lb and Y is the value of the dlookup for the second lb
Example: If the NEW and PROJECT are both highlighted, the GO button should open a form called "F_13" (you get the idea)
Well, my OnClick is thus
Option Compare Databas
Private Sub Go_Click(
DoCmd.OpenForm ("F_" & DLookup([ActionID], "T_Action", "T_Action.Action = Forms!F_Switchboard.LB_Action") & DLookup([CategoryID], "T_Category", "T_Category.Category = Forms!F_Switchboard.LB_Category")
End Su

I think the problem is that the first argument to DLookUp must be
*text string* containing the name of the field to be looked up - yo
have the value of the field itself. Put [ActionID] and [CategoryID] i
quotes

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=publi
 
Back
Top