Getting query results onto form thru Combobox and VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ebasshead
    New Member
    • May 2007
    • 37

    #1

    Getting query results onto form thru Combobox and VBA

    Hi Everybody,

    Behind a combo box on an open form, I have the below code to run a query, which it does, and pops up the query results.. MaxofID, NPPricePerWeek and IDProperty2, in data sheet view.

    I would like to have the query run in the background and not pop up as a datasheet, and then.
    I would like to get the results back onto the form for calculations.

    Can someone please point me in the right direction, I'm not sure what to do next
    and my VBA skills are almost zero.

    Code:
    Private Sub CboProperty_AfterUpdate()
    On Error GoTo Err_CboProperty_AfterUpdate
    
        Dim stDocName As String
    
        stDocName = "tblRRNewPropertyPrice3"
        DoCmd.OpenQuery stDocName, acNormal, acEdit
    
    Exit_CboProperty_AfterUpdate:
        Exit Sub
    
    Err_CboProperty_AfterUpdate:
        MsgBox Err.Description
        Resume Exit_CboProperty_AfterUpdate
        
    End Sub
    Cheers Eddie
  • gnawoncents
    New Member
    • May 2010
    • 214

    #2
    It sounds like you would be better served by drawing the calculations directly from the form without a formal query.

    Please tell me a little about your form inputs and what calculations you are trying to do and I can be more specific.

    Comment

    Working...