Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good Day:

Im Having a problem regarding with my project..

The problem is:
I want to show the saved files in FORM USING ACCESS 2003. all text boxes shows It's data except for CHECKBOX..

Is anyone here who is willing to help regarding with my project?

HERE'S MY CODE:

VB
Public Sub FillFields()
    If Not (rs.BOF = True Or rs.EOF = True) Then
        Text7.Text = rs.Fields("Field2")
        Text8.Text = rs.Fields("Field3")
        Combo1.Text = rs.Fields("Field1")
        Text9.Text = rs.Fields("field4")
        Text10.Text = rs.Fields("field5")
        Text11.Text = rs.Fields("field6")
        Text12.Text = rs.Fields("field7")
        Text13.Text = rs.Fields("field8")
        Text14.Text = rs.Fields("field9")
        Check1.Value = rs.Fields("field10") <<<< PROBLEM
        Check2.Value = rs.Fields("field11") <<<< PROBLEM
    Else
        Text7.Text = ""
        Text8.Text = ""
        Combo1.Text = ""
        Text9.Text = ""
        Text10.Text = ""
        Text11.Text = ""
        Text12.Text = ""
        Text13.Text = ""
        Text14.Text = ""
        Check1.Value = 0
        Check2.Value = 0
        Check3.Value = 0
        Check4.Value = 0
        Check5.Value = 0
        Check6.Value = 0
        Check7.Value = 0
    End If
End Sub


the error says:

Run Time Error '380':
Invalid Property Value

The Check1.Value = rs.Fields("field10") here is the highlight of error

big thanks!
I NID ANSWER ASAP..
THANKS!!!!! @..@
Posted
Updated 17-Jul-12 23:05pm
v2
Comments
jonnard 18-Jul-12 5:13am    
I nid answer so badly.. :(
Sandeep Mewara 18-Jul-12 15:07pm    
Answered.

1 solution

Check1.Value = rs.Fields("field10")
Your naming convention suggests that Check1 is a checkbox and thus it's value can be either True or False.

Now, based on the error, it looks like rs.Fields("field10") is not True or False. Either it is Nothing or something other than boolean value.
First check for Nothing, post that convert the value into bool and then assign to checkbox.

Try:
VB
If rs.Fields("field10") Is Not Nothing
  Check1.Value = Convert.ToBoolean(rs.Fields("field10"))
End If


P.S.: Above is just a sample code snippet. It still does not makes sure that the returned value is of Bool type.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900