AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Tuesday, March 27, 2012

How to put comma or semicolon in Listbox using AddItem

If you try to add list item, containing text with comma or semicolon, to Access listbox using .AddItem method - item will be split into rows, listbox interpret comma as separator:

Me.List0.AddItem "One, two, three"

image

The trick is to put string in quotes:

Me.List0.AddItem "'One, two, three'"

image

Labels:

Wednesday, March 14, 2012

How to get subform control name

Say you have FormA inserted several times on FormB as subform, and you want to know subform control name from button click event on FormA – you can use this code:

MsgBox "Subform control name is: " & _
Me.Parent.ActiveControl.Name

Labels: