Access 97 vs Access 2002, incompatibility

eyemgod

Board Regular
Joined
May 29, 2003
Messages
60
Hi have not use Acces for a while, now I'm trying to work on a project.
I took my old code out, but it does not work with Access 2002.

This is an example... what do I need to change to make it compatible with Access 2002

Thanks

--------------------------------
Option Compare Database
Option Explicit

Dim rstSearchColor As Recordset
Dim dbDL As Database


Private Sub Form_Load()

Set dbDL = CurrentDb

End Sub

Private Sub txtColorCode_Exit(Cancel As Integer)

If Not (txtColorCode = "") Then

Set rstSearchColor = dbDL.openrecordset("SELECT [ColorName] FROM [Colors] WHERE [ColorCode] = " + txtColorCode, dbOpenDynaset)

If rstSearchColor.RecordCount = 0 Then
MsgBox "You entered a wrong Color Code. Please try again.", vbOKOnly, "Search Failed"
Else
rstSearchColor.MoveFirst
txtColorName = rstSearchColor![ColorName]
End If
End If

End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You're using DAO. By default, Access 2000 and above does not set a Reference to DAO, so you must do so manually in order to use it. Open a Module, go to Tools, References, and check the DAO 3.6 Object Library and see how far that gets you. Also, make sure to move it in priority above Microsoft ActiveX Data Objects 2.1 Library.

*edit* since you now have a choice between using DAO and ADO and because the Object Models are similar, it is good practice to explicitly declare:

Code:
dim dbDL as DAO.Database
dim rstSearchColor as DAO.Recordset
in order to avoid any further compilation confusion.
 
Upvote 0
Dugantrain said:
Also, make sure to move it in priority above Microsoft ActiveX Data Objects 2.1 Library.
Or just uncheck ADO when checking DAO. Remember to make the one finger salute to Redmond while doing so.

This ADO nightmare is Y. A. fine example of the Antichrist's self-consumed self-appointed-gods' deeming that they know what's best for the user - and screw what the user thinks, or really wants. But in the most AMAZING fluke of nature in the history of data processing, MS Keystone quality control failed to close the loopholes Dugantrain points out!!

Dugantrain gave you a high quality answer, and the rant reflects my sympathies with you, the victim. How many millions of dollars have and continue to be wasted from that simple pompous action chosen by the developers at Microsoft...
 
Upvote 0

Forum statistics

Threads
1,221,596
Messages
6,160,716
Members
451,665
Latest member
PierreF

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top