Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Record Code Not Working After 97 > XP Conversion 1

Status
Not open for further replies.

DawsonUK

Programmer
Nov 22, 2002
38
0
0
GB
Hi, I was wondering if anyone could help with the error I am recieving. Upon running the following code behind my Delete and Cancel buttons, I get the following Popup.

Complile Error : Method or data member not found

The code used behind my Delete and Cancel buttons is listed below:

Dim D As Database
Dim T As Recordset
If MsgBox("Are you sure you want to permamently delete this record?", 292) = 6 Then
Set D = CurrentDb()
Set T = D.OpenRecordset("TableName")
T.FindFirst "[PrimaryKey] = " & Me![PrimaryKey]
T.Delete
'Close the form
DoCmd.Close
End If

The database has recently been converted from Access 97 to Access XP, and the code has stopped working. Is there a reference that has to be checkred to allow this code to work again?

The database is split in two parts, a front end and a back end.

I hope someone is able to help, I'll be so grateful, you could save me about a week of coding!

Thanks in advance,

David Dawson
 
You need to manually add in the reference to DAO 3.6 (Tools, References from the VBA IDE) and ensure that it comes above the default ADo reference in the refernces list.

Hope this helps.

[pc2]
 
Hi,

Thanks for the reply, however, the problem is Still there. All checking the Box for DOA 3.6 seems to do in my database is severly slow it down.

Any other suggestions as how to get rid of it?

David

 


Dim D As Database
Dim T As Recordset
If MsgBox("Are you sure you want to permamently delete this record?", 292) = 6 Then
Set D = CurrentDb()
Set T = D.OpenRecordset("TableName")
T.FindFirst "[PrimaryKey] = " & Me![PrimaryKey]
T.Delete
'Close the form
DoCmd.Close
End If



That usually doesn't work after a conversion. Switch the two lines to "D as DAO.Database" and "T as DAO.Recordset" and see if THAT fixes the problem. It should.
 
Hi, thanks for the reply! Works perfectly, now it means I have to change about 60 forms... ARGH!

But, since converting to XP and Enabling the DAO reference again, my database is running so slow.... shockingly slow infact, at least half the speed it was on Access 97.

My PC Spec should be up to the job (PC at work, dont laugh!) Its a 1.7ghz P4 with 256mb Ram, it should be sufficient. The only problem I can see is I have loads of combo boxes on the main menu, and a requery running on each combo box when the main menu is activated. I know this is bad coding, but I couldn't think of a better work around.

Any ideas how to speed it up?
My access won't let me create an MDE for some reason!

Oh, and have a star for solving my problem, its greatly aoppreciated!

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top