IN THE SPOTLIGHT: MDE to MDB Conversion Service
(also supports: ACCDE to ACCDB, ADE to ADP, etc)
IN THE SPOTLIGHT: vbWatchdog
VBA error handling just got easier...
" vbWatchdog is off the chart. It solves a long standing problem of how to consolidate error handling into one global location and avoid repetitious code within applications. "
- Joe Anderson,
Microsoft Access MVP
Meet Shady, the vbWatchdog mascot watching over your VBA code →
(courtesy of Crystal Long, Microsoft Access MVP)
IN THE SPOTLIGHT: vbMAPI
An Outlook / MAPI code library for VBA, .NET and C# projects
Get emails out to your customers reliably, and without hassle, every single time.
Use vbMAPI alongside Microsoft Outlook to add professional emailing capabilities to your projects.
Provided by Allen Browne.
It is possible to use an unbound combo box in the header of a form as a means of record navigation. The idea is to select an entry from the drop-down list, and have Access take you to that record.
Assume you have a table called "tblCustomers" with the following structure:
CustomerID AutoNumber (indexed as Primary Key). Company Text ContactPerson Text
A form displays data from this table in Single Form view. Add a combo box to the form's header, with the following properties:
Name cboMoveTo Control Source [leave this blank] Row Source Type Table/Query Row Source tblCustomers Column Count 3 Column Widths 0.6 in; 1.2 in; 1.2 in Bound Column 1 List Width 3.2 in Limit to List Yes
Now attach this code to the AfterUpdate property of the Combo Box:
Sub CboMoveTo_AfterUpdate () Dim rs As DAO.Recordset If Not IsNull(Me.cboMoveTo) Then 'Save before move. If Me.Dirty Then Me.Dirty = False End If 'Search in the clone set. Set rs = Me.RecordsetClone rs.FindFirst "[CustomerID] = " & Me.cboMoveTo If rs.NoMatch Then MsgBox "Not found: filtered?" Else 'Display the found record in the form. Me.Bookmark = rs.Bookmark End If Set rs = Nothing End If End Sub
The steps this procedure takes are:
Note: If CustomerID is a Text type field in your table, you need extra quotes, i.e.:
rs.FindFirst "[CustomerID] = """ & Me.cboMoveTo & """"
For an explanation, see Quotation marks within quotes.
If you want to create a search form, not merely a navigation combo, see the Search Criteria database.
|Home||Index of tips||Top|
This is a cached tutorial, reproduced with permission.
Have your say - comment on this article.
What did you think of 'Using a Combo Box to Locate Records'?
20 October 2010
Thanks for the tutorial, this is one trick I have needed many times in the past. Very Much appreciated.
Have your say...