Allen Browne's CboMoveto

A

Anne

I have been using this combo box over and over.
Now I created a new unbound form with only the combo box I get an error
message: Run-time error 2455. You entered an expression that has an invalid
reference to the property Dirty.
GHBenchID is a primary field on the subform and cbomoveto is an unbound
combobox which looks to cboGHBench with a column count of 1, that field is
the GHBenchID.
My DAO 3.6 Object library is active no errors in the reference libraries. If
I take out the me dirty, then I get error 7951 with an invalid reference to
Record Set clone properties.
Help, what am I looking for to resolve this?

Private 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 "[GhBenchID] = " & 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
 
T

TonyT

An Unbound form with no recordsource cannot get Dirty - you need at least to
set the recordsource for the form or have a bound control to get dirty.

TonyT..
 
A

Allen Browne

Quite correct, Tony. Dirty does not apply to an unbound form.

Of course, an unbound form does not have a RecordsetClone either. And it
does not have any records to move to.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

TonyT said:
An Unbound form with no recordsource cannot get Dirty - you need at least
to
set the recordsource for the form or have a bound control to get dirty.

TonyT..

Anne said:
I have been using this combo box over and over.
Now I created a new unbound form with only the combo box I get an error
message: Run-time error 2455. You entered an expression that has an
invalid
reference to the property Dirty.
GHBenchID is a primary field on the subform and cbomoveto is an unbound
combobox which looks to cboGHBench with a column count of 1, that field
is
the GHBenchID.
My DAO 3.6 Object library is active no errors in the reference libraries.
If
I take out the me dirty, then I get error 7951 with an invalid reference
to
Record Set clone properties.
Help, what am I looking for to resolve this?

Private 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 "[GhBenchID] = " & 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top