move next commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • indhu
    New Member
    • Oct 2006
    • 140

    #31
    Originally posted by hariharanmca
    Give in this way
    Before opening the record set, give
    Set storyboard = Nothing
    storyboard.Curs orLocation = adUseClient
    storyboard.Open strYourQry, Connection, adOpenDynamic, adLockReadOnly

    then you can get record count value

    Code:
    Set storyboard = Nothing
    storyboard.CursorLocation = adUseClient
    storyboard.Open "select * from xyz table, Connection, adOpenDynamic, adLockReadOnly
    runtime error 91
    error in cursor location. object variable or with block not set

    Comment

    • hariharanmca
      Top Contributor
      • Dec 2006
      • 1977

      #32
      Originally posted by indhu
      Code:
      Set storyboard = Nothing
      storyboard.CursorLocation = adUseClient
      storyboard.Open "select * from xyz table, Connection, adOpenDynamic, adLockReadOnly
      runtime error 91
      error in cursor location. object variable or with block not set

      You have to create ‘NEW’ Instance
      Just copy the function where you are using these lines.

      Comment

      • indhu
        New Member
        • Oct 2006
        • 140

        #33
        Originally posted by indhu
        Code:
        Set storyboard = Nothing
        storyboard.CursorLocation = adUseClient
        storyboard.Open "select * from xyz table, Connection, adOpenDynamic, adLockReadOnly
        runtime error 91
        error in cursor location. object variable or with block not set
        hari, if create a new instance of recordset only it showing me correct recordset.


        Code:
        Private Sub Form_Load()
        myconnection
        
        Set storyboard = Nothing
        
        Set storyboard = New ADODB.Recordset
        storyboard.CursorLocation = adUseClient
        
        storyboard.Open "SELECT sequence, scenes, filename, panel, action, dialogue FROM panel WHERE scenes = '" & scenecombo.Text & "'", CON, adOpenDynamic, adLockReadOnly
        
        Call sceneLOAD
        
        Do While Not storyboard.EOF
        scenecombo.AddItem storyboard!sceneid 'List all the sceneID items into the ComboBox
        storyboard.MoveNext
        Loop
        
        ' Close  Recordset
        storyboard.close
        
        ' Clear the memory
        Set storyboard = Nothing
        
        End Sub

        Comment

        • hariharanmca
          Top Contributor
          • Dec 2006
          • 1977

          #34
          Originally posted by indhu
          hari, if create a new instance of recordset only it showing me correct recordset.


          Code:
          Private Sub Form_Load()
          myconnection
          
          Set storyboard = Nothing
          
          Set storyboard = New ADODB.Recordset
          storyboard.CursorLocation = adUseClient
          
          storyboard.Open "SELECT sequence, scenes, filename, panel, action, dialogue FROM panel WHERE scenes = '" & scenecombo.Text & "'", CON, adOpenDynamic, adLockReadOnly
          
          Call sceneLOAD
          
          Do While Not storyboard.EOF
          scenecombo.AddItem storyboard!sceneid 'List all the sceneID items into the ComboBox
          storyboard.MoveNext
          Loop
          
          ' Close  Recordset
          storyboard.close
          
          ' Clear the memory
          Set storyboard = Nothing
          
          End Sub


          Private Sub Form_Load()
          myconnection
          Dim storyboard as New ADODB.Recordset
          Set storyboard = Nothing
          storyboard.Curs orLocation = adUseClient
          storyboard.Open "SELECT sequence, scenes, filename, panel, action, dialogue FROM panel WHERE scenes = '" & scenecombo.Text & "'", CON, adOpenDynamic, adLockReadOnly

          Call sceneLOAD

          Do While Not storyboard.EOF
          scenecombo.AddI tem storyboard!scen eid 'List all the sceneID items into the ComboBox
          storyboard.Move Next
          Loop

          ' Close Recordset
          storyboard.clos e

          ' Clear the memory
          Set storyboard = Nothing

          End Sub

          Set storyboard = Nothing ' in not mandatory if you create new instance
          Use this Code which i changed

          Comment

          • indhu
            New Member
            • Oct 2006
            • 140

            #35
            Originally posted by hariharanmca
            Private Sub Form_Load()
            myconnection
            Dim storyboard as New ADODB.Recordset
            Set storyboard = Nothing
            storyboard.Curs orLocation = adUseClient
            storyboard.Open "SELECT sequence, scenes, filename, panel, action, dialogue FROM panel WHERE scenes = '" & scenecombo.Text & "'", CON, adOpenDynamic, adLockReadOnly

            Call sceneLOAD

            Do While Not storyboard.EOF
            scenecombo.AddI tem storyboard!scen eid 'List all the sceneID items into the ComboBox
            storyboard.Move Next
            Loop

            ' Close Recordset
            storyboard.clos e

            ' Clear the memory
            Set storyboard = Nothing

            End Sub

            Set storyboard = Nothing ' in not mandatory if you create new instance
            Use this Code which i changed
            nothing is loaded.

            Comment

            • hariharanmca
              Top Contributor
              • Dec 2006
              • 1977

              #36
              Originally posted by indhu
              nothing is loaded.
              i am not get you ( Explain what is happen)

              Comment

              • indhu
                New Member
                • Oct 2006
                • 140

                #37
                Originally posted by hariharanmca
                i am not get you ( Explain what is happen)
                the form is not loaded with no data. even combo box.

                i tried by calling a procedure also

                Call tblLOAD
                projecttxt.Text = storyboard!proj ect ' error as item cannot be found in collection
                i ve declared the query in tblload but still it showing error here.

                Comment

                • hariharanmca
                  Top Contributor
                  • Dec 2006
                  • 1977

                  #38
                  Originally posted by indhu
                  the form is not loaded with no data. even combo box.

                  i tried by calling a procedure also

                  Call tblLOAD
                  projecttxt.Text = storyboard!proj ect ' error as item cannot be found in collection
                  i ve declared the query in tblload but still it showing error here.

                  JUST COPY THE CODE

                  are you sure all the fields that you specified in QRY are thre in Database

                  Comment

                  • indhu
                    New Member
                    • Oct 2006
                    • 140

                    #39
                    Originally posted by hariharanmca
                    JUST COPY THE CODE

                    are you sure all the fields that you specified in QRY are thre in Database
                    yeah am sure. it has all the data.

                    anyway it calls the sceneload procedure. the data has to come na.
                    nothing is coming.

                    Comment

                    • hariharanmca
                      Top Contributor
                      • Dec 2006
                      • 1977

                      #40
                      Originally posted by indhu
                      yeah am sure. it has all the data.

                      anyway it calls the sceneload procedure. the data has to come na.
                      nothing is coming.

                      i am not asking about data,
                      asking about field and field names in table

                      Comment

                      • indhu
                        New Member
                        • Oct 2006
                        • 140

                        #41
                        Originally posted by hariharanmca
                        i am not asking about data,
                        asking about field and field names in table
                        same field name.

                        first let me rectify this. y its going to second record. and if i click nextitem from combo not opening. if i click nextcommand button it moves. so it is happening like this.

                        Code:
                        Private Sub scenecombo_Click()
                        
                        myquery = scenecombo.Text
                        
                        Call sceneLOAD
                        
                        If Not storyboard.EOF Then
                        storyboard.MoveNext
                          If storyboard!sceneid = myquery Then
                        Call rLOAD
                           sequcombo.Text = storyboard!sequence
                           panel_txt.Text = storyboard!Panel
                           action_txt.Text = storyboard!Action
                           dialogue_txt.Text = storyboard!dialogue
                           Image1.Picture = LoadPicture(App.Path & "\images\" & storyboard("filename"))
                           noofpanel.Text = storyboard.RecordCount
                        End If
                        End If
                        End Sub

                        Comment

                        • hariharanmca
                          Top Contributor
                          • Dec 2006
                          • 1977

                          #42
                          Originally posted by indhu
                          same field name.

                          first let me rectify this. y its going to second record. and if i click nextitem from combo not opening. if i click nextcommand button it moves. so it is happening like this.

                          Code:
                          Private Sub scenecombo_Click()
                          
                          myquery = scenecombo.Text
                          
                          Call sceneLOAD
                          
                          If Not storyboard.EOF Then
                          storyboard.MoveNext
                            If storyboard!sceneid = myquery Then
                          Call rLOAD
                             sequcombo.Text = storyboard!sequence
                             panel_txt.Text = storyboard!Panel
                             action_txt.Text = storyboard!Action
                             dialogue_txt.Text = storyboard!dialogue
                             Image1.Picture = LoadPicture(App.Path & "\images\" & storyboard("filename"))
                             noofpanel.Text = storyboard.RecordCount
                          End If
                          End If
                          End Sub

                          If Not storyboard.EOF Then
                          storyboard.Move Next
                          If storyboard!scen eid = myquery Then
                          Call rLOAD
                          sequcombo.Text = storyboard!sequ ence
                          panel_txt.Text = storyboard!Pane l
                          action_txt.Text = storyboard!Acti on
                          dialogue_txt.Te xt = storyboard!dial ogue
                          Image1.Picture = LoadPicture(App .Path & "\images\" & storyboard("fil ename"))
                          noofpanel.Text = storyboard.Reco rdCount
                          End If
                          End If


                          why you are giving storyboard.Move Next at the begining of asigen values

                          Comment

                          • indhu
                            New Member
                            • Oct 2006
                            • 140

                            #43
                            Originally posted by hariharanmca
                            If Not storyboard.EOF Then
                            storyboard.Move Next
                            If storyboard!scen eid = myquery Then
                            Call rLOAD
                            sequcombo.Text = storyboard!sequ ence
                            panel_txt.Text = storyboard!Pane l
                            action_txt.Text = storyboard!Acti on
                            dialogue_txt.Te xt = storyboard!dial ogue
                            Image1.Picture = LoadPicture(App .Path & "\images\" & storyboard("fil ename"))
                            noofpanel.Text = storyboard.Reco rdCount
                            End If
                            End If


                            why you are giving storyboard.Move Next at the begining of asigen values

                            Actualliy, am telling the recordset to move to next rec. but its starting from 2nd rec. i tried movefirst, it showing only first recordset.

                            Comment

                            • hariharanmca
                              Top Contributor
                              • Dec 2006
                              • 1977

                              #44
                              Originally posted by indhu
                              Actualliy, am telling the recordset to move to next rec. but its starting from 2nd rec. i tried movefirst, it showing only first recordset.

                              Of course, you have to view first record isit...

                              if you give movenext, then the recordset will move to the next record and then show you the second record

                              Comment

                              • indhu
                                New Member
                                • Oct 2006
                                • 140

                                #45
                                Originally posted by hariharanmca
                                Of course, you have to view first record isit...

                                if you give movenext, then the recordset will move to the next record and then show you the second record
                                if i give movefirst, it shows only first recset. not the consecutive recset.

                                Comment

                                Working...