Error message 3167

G

Greg Clark

I have a search field for surname in a form using a combo box. When I try to
use this I get the message "Record is deleted". Help displays error message
3167. Sorting on the surname field doesn't work - it returns the "record is
deleted" message.
 
W

Wayne-I-M

Hi Greg

I don't really understand the problem - you could post more details.

Try this.
Set the row source of the combo like this (change the name of course)

SELECT [TableName].[IDField], [TableName].[Surname],
[TableName].[SomeOtherField], [TableName].[AndAnOtherField] FROM [TableName]
ORDER BY [Surname], [SomeOtherField], [AndAnOtherField];

Column withs = 0;2cm;2cm;2cm
Change this to fit other than the ID field

Combo afterupdate could be

Private Sub ComboName_AfterUpdate()
On Error GoTo ComboName_AfterUpdate_Err
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IDField] = '" & Me![ComboName] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Exit Sub
ComboName_AfterUpdate_Err:
Select Case Err.Number
Case 3167
Resume Exit_ComboName_AfterUpdate
Case Else
MsgBox Err.Description
Resume Exit_ComboName_AfterUpdate
End Select
End Sub

(Change ComboName to what it really is)

BUT - this may not be a good idea (as I said I don't really understand the
problem) all this will do is continue if the error message comes up. It
"may" by that the record really is deleted ??

Post back if you don't understand the code - I'm off to a meeeting all day
now but there are many people on the site who do understand it so they wil be
able to offer (better) advice :)

Good luck
 
T

Tony Toews [MVP]

Greg Clark said:
I have a search field for surname in a form using a combo box. When I try to
use this I get the message "Record is deleted". Help displays error message
3167. Sorting on the surname field doesn't work - it returns the "record is
deleted" message.

That can be a sign of corruption. MAKE A BACKUP COPY OF YOUR
DATABASE.

Then try running Compact and Repair and see what happens.

For more information on corruption including possible causes,
determining the offending PC, retrieving your data, links, official MS
KB articles and a list of vendors who state they can fix corruption
see the Microsoft Access Corruption FAQ at
http://www.granite.ab.ca/access/corruptmdbs.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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