I have an application that uses an *.accdb file as the back-end database. Connecting to and retrieving data from the access file is not an issue and is working quite well.
However, as a precaution, I have the application first check to make sure the database file exists in the application's folder while it loads up. As a convenience, if the database file is not found, then the application creates a new (structured, yet empty) database. The creation of the actual *.accdb file and the creation of the tables is complete and is also working well.
What I cannot figure out, however, is how to create the queries in the *.accdb file.
I use ADOX to create the *.accdb file, and System.Data.OleDb objects to create the tables (using "CREATE TABLE blah (field1 type1, field2 type2, PRIMARY KEY (field1)" sql statements).
Now, I know that if I were programming just in Access VBA, I could add queries using the QueryDef collection, but I can't seem to get it to work from VB2005 (no autosense and program won't build because of the QueryDef DIM statement). Is it perhaps something as simple as not having the proper reference?
I'd appreciate any help on the matter.
Thank you.
Z