i need help here. how do i display checkbox value from my database MS access in a visual basic 6 form? i hv 2 checkbox in my form, which are Available and Not Available. if the value is yes, i want to display it in Available checkbox and if no, the value will be display in Not Available one.. i did try but when i run my program, the value display in both Available and Not Available checkbox. anybody can give me some idea...??? thanks.. :-/

Please focus precisely on the problem. Are you using Visual Basic IDE or the VBA in MS-Access? What mode are you using to connect to the data?
If u can place some sample code with which u have tried and failed, then maybe it would be more helpful for me to understand the problem and help u precisely on the issue you are facing problem with.

To On/Off a checkbox the Value property of the Checkbox is used. If the value=1 then it is ticked, if value=0 then the tick is removed.

suppose u get the value of some column say 'RoomAvail' from a ms-access table into the recordset say 'rst'

then u can write the code for the checkbox something like this

CheckBox1.Value = IIf(UCase(rst!RoomAvail) = "YES",1,0)           'Availabe CheckBox
CheckBox2.Value = IIf(UCase(rst!RoomAvail) = "NO",1,0)            'Not Availabe CheckBox


If UCase(rst!RoomAvail) = "YES" Then
                 CheckBox1.Value = 1         'Available CheckBox
                 CheckBox2.Value = 0         'Not Availabe CheckBox
                 CheckBox1.Value = 0         'Available CheckBox
                 CheckBox2.Value = 1         'Not Availabe CheckBox
          End If

Shaik Akthar

This article has been dead for over six months. Start a new discussion instead.