Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a series of action queries based on order selected on a form 1

Status
Not open for further replies.

Felix18807

Programmer
Jun 24, 2011
39
GB
I need to allow a user to run a series of action queries based on an order he/she chooses on a form. At the moment I have a series of combo boxes where the user can type the order (1,2,3,4,5 etc).

Code:
Dim vControl As Control
   
    For Each vControl In Me.Controls
    If vControl = 1 Then
    'Run the query based on the control name.
    

    End If
    Next

    For Each vControl In Me.Controls
    If vControl = 2 Then
    'Run the query based on the control name.
    

    End If
    Next

etc

Is this possible?




 
Code:
    dim intCounter as integer
    Dim vControl As access.Control
    const numberCombos = 6 ' the number of combos
    
    do  
       intCounter = intCounter + 1
       For Each vControl In Me.Controls
        if vControl.controlType = acCombobox
          if vControl.value = intCounter
          currentDb.execute vControl.tag
        end if
      Next
   loop until ctlCount = numberCombos
 
Oops. I forgot to put a "then" on my if and I am missing an end if.
 
Wow that's all new to me but will be most useful in the future. Thank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top