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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

4.0 vs 6.0 mismatched 1

Status
Not open for further replies.

SilverBean

Programmer
May 23, 2001
44
US

I have this code fragment which is giving me fits under 6.0, and apparently worked fine under 4.0.

Dim myWS As Workspace
Dim myDB As Database
Dim myRecordset As Recordset

SET myDB = Workspaces(0).OpenDatabase(strDbName_Path)
SET myRecordset = myDB.OpenRecordset("Select * from tblMgeAcc", dbOpenSnapshot)

The Set myRecordset = is causing a type mismatch during run time under 6.0. This has been simplified and the intent is well hidden in what I present here, a Snap shot is all that is required it appears the logic just wants to examine some fields to see if a certain operation is legal/ makes sense.

The database being used is really very simple(*.MDB). It is a single user design and is not much more than a place to hold data. Hopefully I'm not running into any sharing, username, password type problems.

I can't contact the original genius behind this but I guess he is doing this instead of just using another hidden data control on the form. The concern is that he's done this in other areas so if 6.0 just needs more info or if some default thing is no longer legal now - that's a far simpler change then a major rework.

Most of the application is working fine so the database itself (MDB) might be pretty old (i.e., whatever was current around VB 4.0). Any chance the database itself could be causing the problem?
 
First off, you are better off NOT using hidden data controls . . . that being said, I would recommend that you check you project references and make sure that you are referencing a version of DAO that will work with VB6. I would then convert the database into a newer version of Access . . . I am guessing that it is in Access 2.0 since the VB App was written in VB4.
Finally, was the VB4 code 16-Bit or 32-Bit? - Jeff Marler B-)
 

I informed you your tip was helpful by mistake - I appreciate your time so heck have a vote on me.

It was helpful to the extent that at least there's nothing fundamentally wrong with the manner of getting at this "table" data under 6.0. I forgot to mention in the original plea that the variable strDbName_Path has been examined and is absolutely correct.

I mentioned the fact that this was probably an old database because that just dawned on me right before I made the post. However, I think I failed to stress that other parts of this application seem to be working fine. "Working fine" defined as data in other tables can be edited, modified, etc. and "seem to be" defined as I haven't seen all areas of the application working. I also want to note that these areas that are "working fine" are using a hidden data control, which we don't need to hash out here. If I had any reference problems, component problems, or some other Jet/ DAO problems I think they would wring out in other areas of this application, rather then in this simple "snapshot" of some fields; however, I am the one asking for help what do I know?

I created a new database under the 6.0 Visual Data Manager and attempted the same type of sequence and still got the same "type mismatch". My plan of attack now is to start over with a new native VB 6.0 smaller project and prototype very similar logic. If you know for sure specifically what references I would need, components, controls, etc. to include in order to JUST perform the sequence in the original post that would be helpful to know. In addition, if you've got some good links, references, books on the subject that would be helpful also. I know enough to be dangerous and the "circling the wagons" approach might just teach me something I don't already know. Beyond that I don't know what else to ask.

The original application was running under Windows 3.1, so based on that I would say it was 16 bit.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top