Results 1 to 7 of 7

Thread: Question about stored procedures

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Question about stored procedures

    Hi,

    I have a stored procedure which select various values from 3 tables using inner joins
    now my question is I have to display these values via a form using unbound
    controls now instead of writing
    rsset!quoteref = me.quoterefid etc etc...is there any quicker way of getting
    these values displayed!!
    Hope this is clear!

    secondly = can i return all values from a SP and use the record selector of
    a MSaccess form to scroll through the recordset or do I have to create
    2 new buttons previous and next record?

    thanks
    ** HOLLY **

  2. #2
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: Question about stored procedures

    Firstly, you won't be able to scroll through your records if they are unbound unless you are going to code all the Next/Previous etc buttons to navigate your recordset.

    And to your first question, No.

  3. #3

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Question about stored procedures

    Hi..I thought the answer would be something of that nature...so it is exaclty
    what i have done..but when I try to move to the previous record I receive
    an error' object cannot be used in this context' have you any ideas?
    Code:
    private sub movenextRec()
    
    If GEdibass.state = adstateclosed then
      openconnection
    else
        rsset.moveprevious
    end if
    
    end sub
    thanks
    ** HOLLY **

  4. #4
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: Question about stored procedures

    Well your going to want to test to make sure your not already at the beginning of your recordset. What language and Objects are you using? It could be your OpenConnection is failing.

    Code:
    If Not rs.BOF Then
       rs.MovePrevious
    End If

  5. #5

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Question about stored procedures

    I'm using VBA the code I have is

    Code:
    Private Sub Command140_Click()
    On Error GoTo Err_Command140_Click
    
    
        If gEDIBass.State = adStateClosed Then
            CreateConnection
        Else
          rsSet.MovePrevious
           If Not rsSet.BOF = trueThen
              loadvalues
                Else
                 MsgBox ("Already at the first record"), vbCritical
           End If
        End If
    
    Exit_Command140_Click:
        Exit Sub
    
    Err_Command140_Click:
        MsgBox Err.Description
        Resume Exit_Command140_Click
        Resume
    End Sub
    and it fails with an error on the rsset.moveprevious

    Anyone!!!
    ** HOLLY **

  6. #6
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: Question about stored procedures

    Is your recordset ADO?
    http://www.w3schools.com/ado/met_rs_movefirst.asp

    Not sure if it is supported in DAO (which is what Access uses by default).

    So it should work if...
    A)Connection is open
    B)Recordset is loaded
    C)Recordset is not BOF or EOF

  7. #7

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Question about stored procedures

    The recordset is open for the live of the form, I'm using ado and the recordset
    is not at the EOF or BOF as the recordset contains 145 records....

    plus it still does not work and I'm still rceiving the error!!
    ** HOLLY **

Posting Permissions

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



Click Here to Expand Forum to Full Width