CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2013
    Posts
    3

    Please Help Vb6 program dealing with Time

    Hi can you help me

    i have vb6 program and ms access database.

    I encode data to my program and save to database.

    i want to know for example i change the data to my database how did my program automatically change the value of the save one.

    SCENARIO :
    (encoded to program)
    Name : Randy
    Position : Janitor
    Process : Cleaning Cr
    Time of Process : 0.5 hrs

    i have a database for all the process and time. what i want is when i edit the time of process the save record for randy will automatically change the time of process also.

    PLEASE HELP!!!

  2. #2
    Join Date
    Nov 2013
    Posts
    3

    Re: Please Help Vb6 program dealing with Time

    for example when i edit the database of Process and Time
    Process : Cleaning Cr Time of Process : 1 hr (change from 0.5)
    i want all saved data with process : cleaning cr will automatically change all its value to 1hr

  3. #3
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Please Help Vb6 program dealing with Time

    Study ADO and SQL
    You need to learn about how to open and close recordsets,
    how to read, modify and delete records, etc.
    But if you post the code where you have problems then somebody else could help you
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  4. #4
    Join Date
    Nov 2013
    Posts
    3

    Re: Please Help Vb6 program dealing with Time

    Quote Originally Posted by jggtz View Post
    Study ADO and SQL
    You need to learn about how to open and close recordsets,
    how to read, modify and delete records, etc.
    But if you post the code where you have problems then somebody else could help you

    Please see what is the problem here. my program always hang when i click this command button. im trying to make a button that will automatically update all records on my adodc3. after changing value in my adodc2
    Code:
    Do until Adodc3.Recordset.EOF
    
    'combo 3
    Adodc2.RecordSource = "select * from addcodes where codez = '" & Text142.Text & "'"
    Adodc2.Refresh
    Text171.Text = Adodc2.Recordset("codez")
    Text172.Text = Adodc2.Recordset("timez")
    
    Text31.Text = Val(Text172.Text) * Val(Text25.Text)
    Text10.Text = Text172.Text
    Adodc3.Recordset("strtl1") = Text31.Text
    
    Adodc3.Recordset.MoveNext
    Loop
    
    
    
    strconfirm = MsgBox("Update finished!", vbExclamation + vbOKOnly, "Skykitchen")
    Adodc3.Recordset.Update
    Adodc3.Refresh
    Adodc3.Refresh
    Last edited by GremlinSA; November 6th, 2013 at 02:22 AM. Reason: added code tags

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Please Help Vb6 program dealing with Time

    [CODE]
    Do until Adodc3.Recordset.EOF

    Loop
    [/
    CODE]

    This will loop forever. Create and instance of Adoc3 (and delete when done)

    Samples have been posted many times. search is your friend
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Please Help Vb6 program dealing with Time

    Try moving the
    Adodc3.Recordset.Update
    just before
    Adodc3.Recordset.MoveNext

    The Update will be in a record by record basis
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  7. #7
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Please Help Vb6 program dealing with Time

    A bit besides the topic. masternz06 You should also start naming your controls properly. A name such as Text171 and Text172 is very ridiculous. How on earth can you remember what Textbox 39, or Textbox 73 does. Give them proper names. Also, the more controls you have on your form, the more troublesome your form will react.

  8. #8
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Please Help Vb6 program dealing with Time

    Quote Originally Posted by HanneSThEGreaT View Post
    A bit besides the topic. masternz06 You should also start naming your controls properly. A name such as Text171 and Text172 is very ridiculous. How on earth can you remember what Textbox 39, or Textbox 73 does. Give them proper names. Also, the more controls you have on your form, the more troublesome your form will react.
    Agreed those names would get out of hand quick, I can't even imagine 172 text boxes on a form.

    Of course I am guilty of not using descriptive names in many of my projects just for ease of coding and execution speed.
    For example if I had a recordset that was returning 30 fields that I needed to display I would likely take the easy way out and write something like
    Code:
    For x=0 to rs.fields.count-1
         Text1(x).Text=Rs.Fields(x)
    Next
    and of course for clearing them
    Code:
    For x=0 to 29
         Text1(x).text=""
    Next
    But I am lazy
    Always use [code][/code] tags when posting code.

  9. #9
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Please Help Vb6 program dealing with Time

    Also, a more important thing...
    DO NOT use ADO Data Control
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

Tags for this Thread

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

Featured