S
Steve
I've designed a form to help keep track of quantites as opposed to hours. Its
got 3 labels and 3 corresponding text boxes, Task Name, Estimated Quantity,
and Completed Quantity. The labels are; txtqtype, txtqest, txtqcom
respectively. There is an ok and cancel button as well.
Im not a regualr programmer but I was able to figure out how to make it do
what I want it to do. I figured the formatting would be the easy stuff. I was
wrong. It is supposed to read the information in the Task Name field in
Projects, truncate the part of the string in parenthesis and print the
remainder into the text box txtqtype. For txtQest it reads the string and
truncates everything outside of the parenthesis the prints the value to the
textbox txtqest.
I want that string to be displayed when I start the form up and the cursor
to defualt on the bottom textbox txtqcom. This is what I have as far as
reading and displaying the string.
Private Sub txtQtype_Enter()
Dim Qtype, Qvar, Qstop
Qvar = ActiveCell
If Qvar = Empty Then
txtQtype.Locked = False
Else
txtQtype.Locked = True
txtQtype.BackColor = RGB(180, 180, 180)
End If
Qstop = InStr(1, Qvar, "(", vbTextCompare)
If Qstop = 0 Then
Qtype = Qvar
txtQtype.Text = Qtype
Else
Qtype = Left(Qvar, Qstop - 1)
txtQtype.MaxLength = Qstop - 1
txtQtype.Text = Qtype
End If
End Sub
I dont even know if I should be using the Enter event. But its the only
thing I can do to get even close to what I want to happen. If someone could
help me out with this I'd appriciate it. Sorry its not commented. Also I'd
like to know how to make pressing the Enter button when in a textbox function
the same as clicking OK.
got 3 labels and 3 corresponding text boxes, Task Name, Estimated Quantity,
and Completed Quantity. The labels are; txtqtype, txtqest, txtqcom
respectively. There is an ok and cancel button as well.
Im not a regualr programmer but I was able to figure out how to make it do
what I want it to do. I figured the formatting would be the easy stuff. I was
wrong. It is supposed to read the information in the Task Name field in
Projects, truncate the part of the string in parenthesis and print the
remainder into the text box txtqtype. For txtQest it reads the string and
truncates everything outside of the parenthesis the prints the value to the
textbox txtqest.
I want that string to be displayed when I start the form up and the cursor
to defualt on the bottom textbox txtqcom. This is what I have as far as
reading and displaying the string.
Private Sub txtQtype_Enter()
Dim Qtype, Qvar, Qstop
Qvar = ActiveCell
If Qvar = Empty Then
txtQtype.Locked = False
Else
txtQtype.Locked = True
txtQtype.BackColor = RGB(180, 180, 180)
End If
Qstop = InStr(1, Qvar, "(", vbTextCompare)
If Qstop = 0 Then
Qtype = Qvar
txtQtype.Text = Qtype
Else
Qtype = Left(Qvar, Qstop - 1)
txtQtype.MaxLength = Qstop - 1
txtQtype.Text = Qtype
End If
End Sub
I dont even know if I should be using the Enter event. But its the only
thing I can do to get even close to what I want to happen. If someone could
help me out with this I'd appriciate it. Sorry its not commented. Also I'd
like to know how to make pressing the Enter button when in a textbox function
the same as clicking OK.