Results 1 to 6 of 6

Thread: Please help me...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Please help me...

    Dear Experts,

    I am doing an assignment and I stack could not thinking about this matter:

    On the VB6 form, I have to create fields that could be added and calculated automatically as follow:

    The original form is, there is one row such as Text Fields: Item No, Description, Qty, Price/Item, Total

    and two Button: "Add Tables" and "Calculate"

    If I click "Add Tables", it will create another row below the first row, and so on.

    After I finished created rows (for an example 7 rows), all amount in the text fields of "Qty" and "Total" will be calculated by clicking "Calculate" then the result will be appeared in another new text field "Total Purchase".

    Anyone could help me to find this solution please?.....I really need your help...

    Thank you for your kind helps and assistance...

    Best Regards,

    Jenifer

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Please help me...

    Ok, create the all the textboxes you want, quantity etc..
    Set all textboxes index to 0. Add a Combobutton and use this code:

    VB Code:
    1. Private Sub Command1_Click()
    2.    Load text1(Ubound+1)
    3.           text1(Ubound).Left = text1(Ubound-1).left
    4.           text1(Ubound).Top = text1(Ubound-1).Top + 300
    5.           text1.visible = true
    6. End Sub

    Now this code needs to be written for each textbox (ive called my textbox simply text1 in this example)
    This will add 1 extra row of textboxes at the click of a button
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Please help me...

    And to the Add button (Ive named your textbox for prices txtPrice):

    VB Code:
    1. Private Sub Command2_Click()
    2. dim TotalCost as double
    3.    for a = 0 to txtPrice.Ubound
    4.       TotalCost = TotalCost + Cdbl(txtPrice.text)
    5.    next a
    6.    txtTotal.Text = TotalCost
    7. End Sub

    Ask if theres something thats not clear enough
    Last edited by Atheist; Nov 30th, 2005 at 05:04 PM. Reason: Didnt see you already had a field for the total cost
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: Please help me...

    Hi Atheist,

    Thank you for your kind helps...However what I mean is, everytime I "Add" rows, it will automatically add rows as well in a Word Document. For instance, everytime I fill Text Fields: Item No, Description, Qty, Price/Item, Total and clicked on "Add" button, it does not only add rows in VB (VBA) but it also would add rows as well including all text into a Word Document. Would you help me please?

    Thanks very much,

    Jennifer

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: Please help me...

    Dear Atheis,

    May be this is what I mean, I made a DUMMY for your reviews and helps..

    Please find my attached dummy as a word document (in Macro Menu then click VB Editor).

    Thank you for your kind helps,

    Jennifer
    Attached Files Attached Files

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Please help me...

    Hello again

    Well, Im not particulary good in office programming...Perhaps you should try n ask in Office development ?
    Or you could try using a database instead? Thats something I could help you with
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

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