Mistake on Microsoft Website Re:- Move to Specific Record - Combo Box (1 Viewer)

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 15:06
Joined
Jul 9, 2003
Messages
16,245
On this Microsoft web page:- https://docs.microsoft.com/en-us/of...e-to-specific-record-from-combo-box-selection

I reckon MS have made a mistake with the code for using a combo-box to locate a record on a Form.

The Code:-

Code:
Private Sub Combo0_AfterUpdate()
     ' Find the record that matches the control.
     Dim rs As Object

Set rs = Me.Recordset.Clone
     rs.FindFirst "[ProductID] = " & Str(Nz(Me![Combo20], 0))
     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

The following line of code refers to the ComboBox as combo20, when in fact it is combo0

Code:
rs.FindFirst "[ProductID] = " & Str(Nz(Me![Combo20], 0))

The line of code should actually be written Thus:-

Code:
rs.FindFirst "[ProductID] = " & Str(Nz(Me![Combo0], 0))
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:06
Joined
Aug 30, 2003
Messages
36,118
I would agree, good eye! I probably wouldn't have noticed just scanning the code.
 

Bullschmidt

Freelance DB Developer
Local time
Today, 10:06
Joined
May 9, 2019
Messages
40
Yes and by the way who really keeps their comboboxes named something like "Combo20" anyways, right :)
 

Users who are viewing this thread

Top Bottom