Results 1 to 3 of 3

Thread: Selecting file data

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    120

    Selecting file data

    cboTreatments-(holds treatment and price)
    User can select up to 4 treatments and prices.
    How can I code so that when the first treatment & price are selected they only populate the 1st lbltreatment and txtprice and then allow me to select a 2nd treatment which populates the 2nd lbltreatment & txtprice etc. Here my code so far.

    Private Sub cboTreatment_Click()
    Dim TreatmanetDetails As String
    TreatmentDetails = cboTreatment.Text

    lblTreat1 = Left(TreatmentDetails, 40)
    txtCost1 = Right(TreatmentDetails, 6)

    lblTreat2 = Left(TreatmentDetails, 40)
    txtCost2 = Right(TreatmentDetails, 6)

    lblTreat3 = Left(TreatmentDetails, 40)
    txtCost3 = Right(TreatmentDetails, 6)

    lblTreat4 = Left(TreatmentDetails, 40)
    txtCost4 = Right(TreatmentDetails, 6)


    txtGross.Text = Val(txtCost1) + (txtCost2) + (txtCost3) + (txtCost4)

    End Sub
    Thanks in anticipation
    Rosi

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Does this help? Of course you'd have to make sure all your label captions were empty strings each time you restarted.

    VB Code:
    1. If lblTreat1 = "" Then
    2.     lblTreat1 = Left(TreatmentDetails, 40)
    3.     txtCost1 = Right(TreatmentDetails, 6)
    4. ElseIf lblTreat2 = "" Then
    5.     lblTreat2 = Left(TreatmentDetails, 40)
    6.     txtCost2 = Right(TreatmentDetails, 6)
    7. Endif
    This world is not my home. I'm just passing through.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    120

    Select file data - resolved

    Hi trisuglow
    Cheers for that code it works a treat
    Rosi

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