Link to home
Start Free TrialLog in
Avatar of bearT
bearT

asked on

MSFlexgrid with Access 2000

Hi,

I would like to find out how we can integrate MSFlexgrid with Access 2000. I am only able to do so with Access 1997.

Under the project's References, I have included Microsoft DAO 3.6 Object Library. Do I need to use ADO? Pls provide more details.

I am not able to refresh the grid after a deletion of a record. The deleted record can still be seen on the grid, even though I have refreshed the grid.

Appreciate your help on this cos I am be bugged by it for quite some time.

Thanks,
bearT
Avatar of pierrecampe
pierrecampe

thats very little information you have given
it should work with DAO 3.6
if you could post some code ?
what may cause problems is that you updated a 97 db to a 2000 db and you have not changed the connect property of the datacontrol,the connect property has to be access 2000 and not access
Avatar of bearT

ASKER

Hi,

This is how I have connected to the database:
Set db = DBEngine.Workspaces(0).OpenDatabase(App.Path + dbAccess)

May I know if the above statement is correct?

Thanks!

BearT
hard to say
App.Path + dbAccess should be App.path & dbAccess
but then again what is 'dbAccess'
also app.path will return 'c:\' if installed in the root
and if 'dbAccess' is something like '\mydb.mdb' then the result will be 'c:\\mydb.mdb' what will generate an error
on the other hand if not installed in the root and 'dbAccess' is 'mydb.mdb" then the result may be something like 'c:\somesubdirmydb.mdb" what will generate an error to(unless you have a somesubdirmydb.mdb in the root)
so if 'App.Path + dbAccess' does not give an error it is ok
the thing is if you can do it with 97 and DAO 3.5 then you can do it with 2000 and DAO 3.6
so what are some possible reasons it wont work:
you have made a program with DAO 3.5 to work against Accses 97
then you have changed DAO 3.5 to 3.6 to work against Access 2000
if you have no datacontrols that will work without problem
if you have datacontrols they will still use DAO 3.5 so you will have to remove them, save your program and quit vb
start vb again open your program insert at new the datacontrols and make sure their connect property is access 2000 *not* access
an other possibility is you have a reference to ADO with a greater priority than the reference to DAO 3.5
if so remove the ADO reference or give it a lower priority or prepend your db and recordsets with DAO
ie:
dim db as DAO.Database
dim rs as DAO.recordset
an other possibility may be the recordset of the datacontrols is a snapshot instead of a table/dynaset
also remember a flexgrid is not dynamicly bound to a datacontrol it is kind of one-shot bound in that once it has read the data in, the data stays static and it wont reflect changes to its datacontrol
as you can see its hard to tell why it wont work without knowing how you code it

Avatar of bearT

ASKER

Hi,

Thanks for the detailed explaination.

1) There is no problem with "App.path & dbAccess" cos I have defined dbAccess as a variable separately.

2) I have attempted to create a new project and this is how I did it.
- select DAO 3.6
- insert data control(Data1) and MS Flexgrid onto the form
- set the RecordSet Type of Data1 to dynaset
- connect MS Flexgrid to Data1
- I have coded the grid this way:

Data1.DatabaseName = App.Path + "\db.mdb"
Data1.RecordSource = "SELECT * FROM Price"
Data1.Refresh

I have these problems:
- There is no "Access 2000" in the Connect property of the data control. Only "Access" is displayed along with the other options. Even when I tried to code this manually by writing -> Data1.Connect = "Access 2000", I get an error:
"Error 3170 : Couldn't find installable ISAM"

- If I just select "Access" for the Connect property, then the system will give me this error:
"Error 3343: Unrecognised database format 'C:\test\db.mdb'". I am always facing this error, but if I change the database to Access 1997, then I would not have any problems.

I have checked that there were no DAO and ADO references. If you do not mind, pls kindly email me at beart24@yahoo.com for the source code, if the details that I have provided is not suffcient.

Appreciate your help and thanks!

BearT
Avatar of bearT

ASKER

Hi,

Thanks for the detailed explaination.

1) There is no problem with "App.path & dbAccess" cos I have defined dbAccess as a variable separately.

2) I have attempted to create a new project and this is how I did it.
- select DAO 3.6
- insert data control(Data1) and MS Flexgrid onto the form
- set the RecordSet Type of Data1 to dynaset
- connect MS Flexgrid to Data1
- I have coded the grid this way:

Data1.DatabaseName = App.Path + "\db.mdb"
Data1.RecordSource = "SELECT * FROM Price"
Data1.Refresh

I have these problems:
- There is no "Access 2000" in the Connect property of the data control. Only "Access" is displayed along with the other options. Even when I tried to code this manually by writing -> Data1.Connect = "Access 2000", I get an error:
"Error 3170 : Couldn't find installable ISAM"

- If I just select "Access" for the Connect property, then the system will give me this error:
"Error 3343: Unrecognised database format 'C:\test\db.mdb'". I am always facing this error, but if I change the database to Access 1997, then I would not have any problems.

I have checked that there were no DAO and ADO references. If you do not mind, pls kindly email me at beart24@yahoo.com for the source code, if the details that I have provided is not suffcient.

Appreciate your help and thanks!

BearT
ASKER CERTIFIED SOLUTION
Avatar of pierrecampe
pierrecampe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial