Solved

Problem with the event

Posted on 2014-10-07
11
192 Views
Last Modified: 2014-10-16
Hi,
I have such event

Private Sub Fld_AfterUpdate()
    MsgBox Right(Me.Fld, 5)
End Sub

to the List box, within Access 2010 project. Upon that, I've selected one other option to that. I see nothing has been displayed. why?
0
Comment
Question by:HuaMinChen
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 12

Expert Comment

by:James Elliott
ID: 40365466
Does the message box display?
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40365478
No. why?
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40365490
Because it doesn't update before you leave the field or record.

/gustav
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 10

Author Comment

by:HuaMinChen
ID: 40365574
thanks. How to ensure that one other event can be fired, upon one change to the list, if "AfterUpdate" event is not the option to use?
0
 
LVL 12

Expert Comment

by:James Elliott
ID: 40365577
try the change event
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40365586
Sorry, I can only see the events attached, which are available to the List box
t826.png
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40365603
Sorry, missed it was a ListBox. Then the AfterUpdate event is your option.

It will work. If it doesn't, something else is going on. Try to recreate the listbox, or start with a new form where you create (from scratch) the ListBox.

/gustav
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40366607
Private Sub Fld_AfterUpdate()
    MsgBox Right(Me.Fld, 5)
End Sub

Is "Fld" the actual name of the control?

From your property box screenshot, ...it looks like the name of the control is: "Identifier"...
screen?

So you might want to try something  like this:
Private Sub Identifier_AfterUpdate()
    MsgBox Right(Me.Identifier, 5)
End Sub
0
 
LVL 36

Expert Comment

by:PatHartman
ID: 40366715
Is there only a single column in the RowSource for the list?  It doesn't sound like it.

Me.YourListBox refers to the bound column of the RowSource which is the key field.  In most cases, this is a numeric identifier and is not the value that is displayed.  Since you are interested in the text value, you need to figure out what column that is.

To reference other columns of the RowSource, use the .Column() property.

MsgBox Right(Me.Identifier.Column(1), 5)

The columns of the RowSource are a zero based array so Column(0) is the first column, Column(1) is the second, etc.  So change my example as appropriate.
0
 
LVL 12

Expert Comment

by:jkaios
ID: 40367309
Try the Click event instead.

Private Sub Fld_Click()
    MsgBox "Item selected: " & Fld.value
End Sub

Open in new window

0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40374366
Thanks all. I'll confirm to all suggestions given.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question