Results 1 to 7 of 7

Thread: [RESOLVED] Electronic Draw

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Location
    Pakistan
    Posts
    289

    Resolved [RESOLVED] Electronic Draw

    Plz check my following code:
    Code:
    Private Sub cmdStop_Click()
        MyRs.Close
        Timer1.Enabled = False
        MyRs.Open "select ename from Draw where pno='" & lblPNO.Caption & "'", MyConn, adOpenKeyset, adLockOptimistic
        lblName.Caption = MyRs.Fields!Ename
        MyRs.Close
    End Sub
    
    Private Sub Form_Load()
        MyConn.Open "Draw"
        MyRs.Open "select * from Draw", MyConn, adOpenKeyset, adLockOptimistic
    End Sub
    
    Private Sub Timer1_Timer()
        lblPNO.Caption = MyRs.Fields!PNO
        MyRs.MoveNext
        If MyRs.EOF Then
           MyRs.MoveFirst
        End If
    End Sub
    This code works fine
    Now I want to make the button for Start it again rather than i run the project again and again. Kindly guide how i make it

  2. #2

    Re: Electronic Draw

    Do the same as you did in form load and then enable the timer.
    Last edited by nvbsoftware; Apr 11th, 2011 at 06:50 PM.

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Electronic Draw

    Try moving the code in Form_Load to a new sub and call that sub whenever needed, ie. at startup and for the start button.


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Location
    Pakistan
    Posts
    289

    Re: Electronic Draw

    I put my code in Start (which is sub routine) and call it through cmdStart, its work fine first time but if i press the stop button and again i click start button then it will give error:
    Error No.3075
    "Operation is not allowed when the object is open"

  5. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Electronic Draw

    Because you are opening the connection again eventhough you haven't closed it !

    This is the line causing the problem:
    Code:
    MyConn.Open "Draw"
    Try closing the connection, when you press the Stop button.


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Location
    Pakistan
    Posts
    289

    Re: Electronic Draw

    Thanks, let me check and confirm

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Location
    Pakistan
    Posts
    289

    Re: Electronic Draw

    Yes, it is works correctly, thank you so much akhileshbc
    Last edited by mcsmba1; Apr 20th, 2011 at 11:16 AM.

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