Go Back   Access World Forums > Apps and Windows > VB.NET

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-27-2010, 07:45 PM   #16
desmond
Newly Registered User
 
Join Date: Dec 2009
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
desmond is on a distinguished road
Re: Update Access column property to checkbox from VB.NET

Quote:
Originally Posted by boblarson View Post
Yes, that's what I'm talking about. But the big thing is that you need to have the right version selected because any DAO reference for Office Versions 11 and prior will have no knowledge of the ACCDB file format. You need to select the version 12 or 14 in order for it to not have an unrecognized database error.
I added a COM reference to Microsoft Office 12.0 Object Library, and Microsoft Office 12.0 Access Database Engine Object Library 12.0.

It made no difference at all.

It still fails on this line (unrecognizable database format):
dbs = dbe.OpenDatabase(
"C:\TestDB.accdb")

After scouring the net, I tried this:

'dbs = dbe.OpenDatabase("C:\TestDB.accdb", False, False, "MSAccess;")

but it failed with 'could not find installable ISAM'.

Is there anything else I can try?

desmond is offline   Reply With Quote
Old 11-22-2010, 01:53 PM   #17
desmond
Newly Registered User
 
Join Date: Dec 2009
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
desmond is on a distinguished road
Re: Update Access column property to checkbox from VB.NET

Well I got this to work for anyone who's having the same issue. I don't understand why this small difference worked, but it did:

Dim dbe As Microsoft.Office.Interop.Access.Dao.DBEngine
Dim dbs As Microsoft.Office.Interop.Access.Dao.Database
Dim fld As dao.Field
Dim prp As dao.Property

dbe = New Microsoft.Office.Interop.Access.Dao.DBEngine()
dbs = dbe.OpenDatabase("C:\TestDB.accdb")
fld = dbs.TableDefs("TestName").Fields("TestFlag")
prp = fld.CreateProperty("DisplayControl", dbInteger, 106)

Try
fld.Properties.Append(prp)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try


Why referencing dbe as Microsoft.Office.Interop.Access.Dao.DBEngine instead of dao.dbengine with the reference set, and setting dbe to a new instance is beyond me, but it works perfectly.

Thanks to Lagbolt and Boblarson for their help.

desmond is offline   Reply With Quote
Reply

Tags
access , checkbox , property , update , vb.net

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating An Executable (exe) Out Of Microsoft Access (mdb, mde) Tips and Tricks nIGHTmAYOR Modules & VBA 32 02-20-2012 04:27 PM
Using Access w/Oracle to update Access Linked table kfschaefer Modules & VBA 0 04-07-2009 09:03 AM
Mouse Scroll Xenix Forms 2 10-08-2006 08:12 PM
Update bit Field in Access using SQL linked Table manojab Queries 11 03-07-2005 08:49 AM
Microsoft project update with MS ACCESS Jacob Mathai General 2 03-02-2005 09:16 AM




All times are GMT -8. The time now is 09:22 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World