Barca
asked on
help~
i want to check what K_Check value(true/false) is.
if K_Check = false
show ID and Quality in richtextbox
what's wrong of my code?
and how to make a newline in richtextbox?
Private Sub cmdReload_Click()
Do While Not DBrstA.EOF
DBrstA.MoveFirst
If DBrstA.Fields("[K_Check]") .Value = False Then
rtbOrder.Text = rtbOrder.Text + "ID" + DBrstA.Fields("[ID]").Valu e + "Quality" + DBrstA.Fields("[Quality]") .Value
DBrstA.Fields("[K_Check]") .Value = True
End If
DBrstA.MoveNext
Loop
End Sub
if K_Check = false
show ID and Quality in richtextbox
what's wrong of my code?
and how to make a newline in richtextbox?
Private Sub cmdReload_Click()
Do While Not DBrstA.EOF
DBrstA.MoveFirst
If DBrstA.Fields("[K_Check]")
rtbOrder.Text = rtbOrder.Text + "ID" + DBrstA.Fields("[ID]").Valu
DBrstA.Fields("[K_Check]")
End If
DBrstA.MoveNext
Loop
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your code should look something like this
Private Sub cmdReload_Click()
DBrstA.MoveFirst
Do While Not DBrstA.EOF
If DBrstA.Fields("[K_Check]") .Value = False Then
rtbOrder.Text = rtbOrder.Text & "ID = "
rtbOrder.Text = rtbOrder.Text & DBrstA.Fields("[ID]").Valu e & vbTab
rtbOrder.Text = rtbOrder.Text & "Quality = "
rtbOrder.Text = rtbOrder.Text & DBrstA.Fields("[Quality]") .Value & vbCr
DBrstA.Fields("[K_Check]") .Value = True
End If
DBrstA.MoveNext
Loop
End Sub
Private Sub cmdReload_Click()
DBrstA.MoveFirst
Do While Not DBrstA.EOF
If DBrstA.Fields("[K_Check]")
rtbOrder.Text = rtbOrder.Text & "ID = "
rtbOrder.Text = rtbOrder.Text & DBrstA.Fields("[ID]").Valu
rtbOrder.Text = rtbOrder.Text & "Quality = "
rtbOrder.Text = rtbOrder.Text & DBrstA.Fields("[Quality]")
DBrstA.Fields("[K_Check]")
End If
DBrstA.MoveNext
Loop
End Sub
ASKER
the problem still not fix
ASKER
the problem still not fix
to check the value of your textbox do this.
Dim BoolCheck As Boolean
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
BoolCheck = True
End If
If Check1.Value = vbUnchecked Then
BoolCheck = False
End If
End Sub
Private Sub Command1_Click()
If BoolCheck = True Then
'Code
End If
If BoolCheck = False Then
'Code
End If
End Sub
Dim BoolCheck As Boolean
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
BoolCheck = True
End If
If Check1.Value = vbUnchecked Then
BoolCheck = False
End If
End Sub
Private Sub Command1_Click()
If BoolCheck = True Then
'Code
End If
If BoolCheck = False Then
'Code
End If
End Sub
what is the field type of [K_Check].
if string, then
If DBrstA.Fields("[K_Check]") .Value = "False" Then
and what's the error message you are getting if any?
if string, then
If DBrstA.Fields("[K_Check]")
and what's the error message you are getting if any?
Is the problem nothing happens
Then it may be the field type of K_Check is not returning a value.
If K_Check is not updating you may ned to add an update statement.
DBrstA.Fields("[K_Check]") .Value = True
DBrstA.update
If you are still stuck
add this statement
debug.print DBrstA.Fields("[K_Check]") .Value
before this one
If DBrstA.Fields("[K_Check]") .Value = False Then
Run the code
Go to the debug window (Ctrl + G) read the value of K_Check.
and post it
Then it may be the field type of K_Check is not returning a value.
If K_Check is not updating you may ned to add an update statement.
DBrstA.Fields("[K_Check]")
DBrstA.update
If you are still stuck
add this statement
debug.print DBrstA.Fields("[K_Check]")
before this one
If DBrstA.Fields("[K_Check]")
Run the code
Go to the debug window (Ctrl + G) read the value of K_Check.
and post it
ASKER
K_Check is a check box
You've lost me
K_Check is a check box
and
DBrstA.Fields("[K_Check]") .Value
I assume DBrstA is recorset
K_Check is a check box
and
DBrstA.Fields("[K_Check]")
I assume DBrstA is recorset
to check the value of your textbox do this.
Dim BoolCheck As Boolean
Private Sub Check1_Click()
If K_Check.Value = vbChecked Then
BoolCheck = True
End If
If K_Check.Value = vbUnchecked Then
BoolCheck = False
End If
End Sub
Private Sub Command1_Click()
If BoolCheck = True Then
'Do whatever you want on true
End If
If BoolCheck = False Then
'Do whatever you want on false
End If
End Sub
Dim BoolCheck As Boolean
Private Sub Check1_Click()
If K_Check.Value = vbChecked Then
BoolCheck = True
End If
If K_Check.Value = vbUnchecked Then
BoolCheck = False
End If
End Sub
Private Sub Command1_Click()
If BoolCheck = True Then
'Do whatever you want on true
End If
If BoolCheck = False Then
'Do whatever you want on false
End If
End Sub
ASKER
the error is can't find the object
"object required"
but i am sure the name of field is true and the type is checkbox in DB(MS access).
"object required"
but i am sure the name of field is true and the type is checkbox in DB(MS access).
ASKER
i know where is my problem now
DBrstA.Fields("[K_Check]") .Value
should be
DBrstA.Fields("K_Check").V alue
the richtextbox still can't show another record in a new line ~
DBrstA.Fields("[K_Check]")
should be
DBrstA.Fields("K_Check").V
the richtextbox still can't show another record in a new line ~
ASKER
thanks to all
i solved all problem now
i solved all problem now
rtbOrder.Text = rtbOrder.Text & "TableID" & DBrstA.Fields("[Id]").Valu