Combo box & duplicate record conflict

caferacer

Registered User.
Local time
Today, 14:43
Joined
Oct 11, 2012
Messages
96
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!
 
If you go into debug mode which line is highlighted?
 
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

The bold text is highlighted yellow in the line, thanks
 
Works OK for me.

Try
Dim rs As Recordset
Set rs = Me.RecordsetClone '<= Remove second full stop
rs.FindFirst "[EquipmentID] = " & str(Nz(Me![Combo76], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

If that does not work, post your database.
 
Sorry for the length in time replying. Unfortunately, the solution proposed above didn't change anything.

I have stripped the form right back with the combo and duplicate record command to see if there was anything obvious or stupid causing the problem.

From my messing about, as far as I can tell it appears that it’s the NotInList event of the combo which is being triggered, causing the problem. However, the combobox is just being used for finding a record? I don’t understand why it is having an impact when trying to copy a record?
 

Attachments

Your database compiles and runs OK for me.

What references do you have set? In the VBA view, select Tools | References from the menu.
 
Screenshots attached. I originally built this DB using A2003 which seems to work okay!

This problem exists on two independent installations of Access 2010, my own private Laptop and a Work Laptop?

It just recompiled okay! re checked but the problem still exists?

I found another thread from someone who had similar symptoms, which I tried to use, but had no success. I mentioned this in my initial posting.

http://www.tech-archive.net/Archive/Access/microsoft.public.access.formscoding/2010-04/msg01058.html

I am at a complete loss??

Thanks
 

Attachments

  • References A2010.jpg
    References A2010.jpg
    76.5 KB · Views: 71
  • References A2003.JPG
    References A2003.JPG
    42.2 KB · Views: 75
I see a difference in the two sets of references. I'd try setting the Access2010 to those in 2003 as much as possible and see what happens. (Obviously using the later version of Office will mean you will have to have ver 14 instead of 11.)
 

Users who are viewing this thread

Back
Top Bottom