Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making a subform display the results of combo box (2k)

    The plan was to get the subform to display all records linked to two criteria selected from a pair of linked combo boxes. I have looked at the cascading combo box example and am getting nowhere fast on this.

    I thought i would try and break it down into little sections and get each working before moving on.

    On frmmain PID should be the result of picking cmbzone and cmbspecific. At this point i haven't done much work to link these two.

    the subform should display all records where PID on the form matches the PID box. This is where i am having issues. My first though was to set up an SQL code that after the PID box was updated would run a query and display the answer. I would then have to look at how to attach a form to this query and display the results in the subform that way.

    But i keep getting an error message.

    Help please.
    Attached Files Attached Files

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: making a subform display the results of combo box (2k)

    Look at the code behind the form and you will find the following line of code prior to the Option statements:
    Form_frmMain -1
    While you are in the code try compiling it, it comes up with the error.

  3. #3
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making a subform display the results of combo

    thanks, that helped a little

    got another error and i can't see why it isn't working as the same code has worked before

    I keep on getting Runtime Error 2001, you canceled the previous operation?


    Private Sub Combo10_AfterUpdate()
    Dim strSQL As String
    Dim qdef As DAO.querydef
    Dim mydb As DAO.Database
    Set mydb = CurrentDb
    mydb.QueryDefs.Delete "query1"

    strSQL = "Select * from tblfault where (tblfault.pid) = '" & Combo10 & "'"
    Set qdef = mydb.CreateQueryDef("Query1", strSQL)

    MsgBox strSQL


    DoCmd.OpenQuery "query1", acViewNormal


    End Sub

  4. #4
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making a subform display the results of combo

    figured it out, i had set tblfault .pid to be a number and then when calling combo10 i was treating it like a text string.

    Now why the error messages can't be a little more helpful....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •