• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Why getting compile error on doubleclick event in a listbox

Using the following code I get a compile error: variable not defined error when doubleclicking on a record in a listbox.  When I double-click on the record it is supposed to open a form to the selected record.

Here is my code:

Private Sub List223_DblClick(Cancel As Integer)

    If IsNull(Me.List223) Then
        DoCmd.OpenForm "frmScriptureRecordEntry", , , , acFormAdd
    Else
         strCriteria = "[RecordID] = " & Me.List223.Column(0)
         DoCmd.OpenForm "frmScriptureRecordEntry", , , strCriteria

End Sub

Open in new window

0
SteveL13
Asked:
SteveL13
1 Solution
 
Rey Obrero (Capricorn1)Commented:
where did you declare "strCriteria"

Private Sub List223_DblClick(Cancel As Integer)

dim strCriteria as string

   If IsNull(Me.List223) Then
        DoCmd.OpenForm "frmScriptureRecordEntry", , , , acFormAdd
    Else
         strCriteria = "[RecordID] = " & Me.List223.Column(0)
         DoCmd.OpenForm "frmScriptureRecordEntry", , , strCriteria

End Sub
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now