Connecting Tech Pros Worldwide Forums | Help | Site Map

Auto Edit record by clicking on listbox

jmoudy77's Avatar
Newbie
 
Join Date: Sep 2007
Location: Clarksville, TN
Posts: 20
#1: Mar 15 '08
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

Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#2: Mar 15 '08

re: Auto Edit record by clicking on listbox


Quote:

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
Expand|Select|Wrap|Line Numbers
  1. Me![read status]="Yes"
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
Expand|Select|Wrap|Line Numbers
  1. Me![read status]=True
instead.

-Stewart
jmoudy77's Avatar
Newbie
 
Join Date: Sep 2007
Location: Clarksville, TN
Posts: 20
#3: Mar 15 '08

re: Auto Edit record by clicking on listbox


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.
Reply


Similar Microsoft Access / VBA bytes