A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo error



 
 
Thread Tools Display Modes
  #1  
Old November 13th, 2009, 04:18 PM posted to microsoft.public.access.forms
nick
external usenet poster
 
Posts: 642
Default Combo error

I receive a run-time error 2147352567 (80020009) when I up date the form and
then using the combo155 to go to advance to another record. The error in SQL
always highlights the LastModified = date in the beforeUpdate. Please show me
the error I have created.
Thank you
Private Sub Combo155_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[SSI] = '" & Me![Combo155] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.Dirty = True Then
If MsgBox("Do you wish to save the changes?", vbQuestion + vbYesNo, "Save
Record?") = vbNo Then
Cancel = True
Me.Undo
Else
LastModified = date
End If
End If
  #2  
Old November 13th, 2009, 04:31 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Combo error

"Nick" wrote in message
...
I receive a run-time error 2147352567 (80020009) when I up date the form
and
then using the combo155 to go to advance to another record. The error in
SQL
always highlights the LastModified = date in the beforeUpdate. Please show
me
the error I have created.
Thank you
Private Sub Combo155_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[SSI] = '" & Me![Combo155] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.Dirty = True Then
If MsgBox("Do you wish to save the changes?", vbQuestion + vbYesNo, "Save
Record?") = vbNo Then
Cancel = True
Me.Undo
Else
LastModified = date
End If
End If



Does this error occur if you modify the record and then go to another
record, without using the combo box?

What is "LastModified"? Is it a bound control on your form?

In general, before navigating to another record, it's a good idea to
explicitly save the current one, if it has been modified. Here's a slightly
better procedure for your combo box's AfterUpdate event:

'------ start of modified code ------
Private Sub Combo155_AfterUpdate()

' Find the record that matches the control.

If Me.Dirty Then Me.Dirty = False

With Me.RecordsetClone
.FindFirst "[SSI] = '" & Me![Combo155] & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub
'------ end of modified code ------

But I'm not sure exactly what caused your error, so I can't guarantee that
this will solve it.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.