Hello everyone,
I have struggled all day with trying to find a solution to a problem I'm having with a combo box and a duplicate record command button.
When using the command button, I get error 2237, "the text you entered isn't in the list". It keeps highlighting "Me.Bookmark = rs.Bookmark" yellow in the combo code.
I have used the wizard to create both the combo and command button previously.
I have found a very similar problem on the internet, where two solutions were proposed, replace in the combo code
If Not rs.EOF Then Me.Bookmark = rs.Bookmark with If Not rs.NoMatch Then Me.Bookmark - rs.Bookmark. THis didn't work, returned a compile error "invalid use of property"
Also, place Me.Combo76.requery directly below the 'paste append line in the command button. This did nothing at all.
Private Sub Combo76_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[EquipmentID] = " & str(Nz(Me![Combo76], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Command44_Click()
On Error GoTo Err_Command44_Click
g_blnCreatingDup = True
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_Command44_Click:
g_blnCreatingDup = False
Exit Sub
Err_Command44_Click:
MsgBox Err.Description
Resume Exit_Command44_Click
End Sub
Any ideas welcome!
I have struggled all day with trying to find a solution to a problem I'm having with a combo box and a duplicate record command button.
When using the command button, I get error 2237, "the text you entered isn't in the list". It keeps highlighting "Me.Bookmark = rs.Bookmark" yellow in the combo code.
I have used the wizard to create both the combo and command button previously.
I have found a very similar problem on the internet, where two solutions were proposed, replace in the combo code
If Not rs.EOF Then Me.Bookmark = rs.Bookmark with If Not rs.NoMatch Then Me.Bookmark - rs.Bookmark. THis didn't work, returned a compile error "invalid use of property"
Also, place Me.Combo76.requery directly below the 'paste append line in the command button. This did nothing at all.
Private Sub Combo76_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[EquipmentID] = " & str(Nz(Me![Combo76], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Command44_Click()
On Error GoTo Err_Command44_Click
g_blnCreatingDup = True
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_Command44_Click:
g_blnCreatingDup = False
Exit Sub
Err_Command44_Click:
MsgBox Err.Description
Resume Exit_Command44_Click
End Sub
Any ideas welcome!