Check Box in Visual Basic and Value in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • godhulirbalaka
    New Member
    • Oct 2007
    • 26

    Check Box in Visual Basic and Value in Access

    Hai, I have a form where few checkbox contorls like

    chk_File
    chk_UserManagem ent
    chk_Transaction

    and a commanbutton named submit

    and a database in access where few fields in User Table like

    FileAcess
    UMAcess
    TransactionAcce ss

    I want set if i click on submit button then if chk_File is checked then the value of FileAccess field in database will Y else N. Simillerly if chk_Transaction is checked means value 1 then in database UserTable TransactionAces s field value will be Y else N. How i can set this
    Please help me
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You simply ned to update the database field on the user selection.
    for ex

    if value of checkbox is 1 update with YES else NO.

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Open the Recordset:

      [code=vb]
      Dim RST As New ADODB.RecordSet
      RST.Open "Select * From MyTable", Conn,adOpenDyna mic,adOpenlockO ptimistic
      If RST.EOF Then
      RST.AddNew
      End If
      If chk_File.Value = vbChecked Then
      RST("FileAcess" ) = "Y"
      Else
      RST("FileAcess" ) = "N"
      End If
      ' Write Code like above for other Checkboxes also..
      RST.Update


      [/code]

      Regards
      Veena

      Comment

      • 9815402440
        New Member
        • Oct 2007
        • 180

        #4
        hi
        data type of fields in question must not be Yes/No. if data type is Yes/No then you can not store "Y" in the field. Data Type should be Text.

        regards
        manpreet singh dhillon hoshiarpur

        Comment

        Working...