Auto Edit record by clicking on listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmoudy77
    New Member
    • Sep 2007
    • 20

    #1

    Auto Edit record by clicking on listbox

    Hi,

    I'v created an internal messaging system within my database. I've got a listbox that displays the current user's messages. When a message in the listbox is clicked on, a listbox below that is populated with the body of that message. My goal is to have the "read status" field for the messages table to change to "Yes" when I click on the listbox as well. I know I need to code this in VB, but really have no idea where to start. Any suggestions?

    Thanks,
    Josh
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by jmoudy77
    Hi,

    I'v created an internal messaging system within my database. I've got a listbox that displays the current user's messages. When a message in the listbox is clicked on, a listbox below that is populated with the body of that message. My goal is to have the "read status" field for the messages table to change to "Yes" when I click on the listbox as well. I know I need to code this in VB, but really have no idea where to start. Any suggestions?

    Thanks,
    Josh
    Hi. You could add code to the On Got Focus event of the list box to change the read status field to "Yes". Right-click on the On Got Focus event within the Properties tab of the listbox and select Build, Code Builder to bring up the VB editor. The builder places a skeleton of the event subroutine into the code for you, and all you have to do is add
    [code=vb]Me![read status]="Yes"[/code]
    then save the changes. It's really easy to do.

    I assume that your "read status" field is a text field. If it is a Yes/No (boolean) field then substitute
    [code=vb]Me![read status]=True[/code]
    instead.

    -Stewart

    Comment

    • jmoudy77
      New Member
      • Sep 2007
      • 20

      #3
      Thanks Stewart,

      I ended up using an update query. You're suggestion would have worked also, but I didn't have the "read status" field displayed in the listbox. This field is never displayed, and only used to update the user's unread mail status on their homepage. Thanks for the help though.

      Comment

      Working...