Linked SQL table doesn't show up as control source
Alright. Here's the scoop:
There's 2 MDB files. One is chock full o' tables.
The other is mostly VBA and forms, and was thrown together by, from what I can ascertain from the existing "programming", drunken squirrels with arthritis.
Now, the "forms" mdb file, which we'll call frontend.mdb for sake of clarity, had the form from which I'd LIKE to execute a SQL "INSERT INTO" command, using data from the form, and several other calculations.
the "tables" mdb file (we'll call it backend.mdb) has the table link to the DSN object for the MYSQL database.
I have constructed a SQL query that, although it works in the "immediate" window of VBA (when fed the proper data in the VALUES() area) and also is given the exact same data when run from a form (I did a MsgBox (strSQLQuery) just to see that the values were right) and.....
NOTHING HAPPENS.
No error message, no ding, no "uhoh!" no information, no nothin'.
This is actually how this little monstrosity behaves if I so much as misconstruct a msgbox, so that's not the surprising part.
What IS surprising is that I don't see the mySQL linked table if I try to, oh, say, map a textbox to a field in the database.
I know they've got some code somewhere to connect frontend.mdb to backend.mdb but it ain't exactly doing a good job of picking up on the new table, and I'm rapidly getting tired of guessing where they've squirreled it away sooo....
If ANYONE out there knows how to connect to a linked SQL table in ONE mdb file from in an onclick() event in ANOTHER mdb file and do a SQL type INSERT INTO command into it, I'd be appreciative.
I've even tried this (pseudocode):
docmd.RUNSQL ( "INSERT INTO mylinked_table ( fields, morefields, etc) IN 'backend.mbd' VALUES ( 'blah', 'blah blah', 'etc')" )
Note the "IN 'backend.mdb'" part.
Even THAT works fine from Frontend.mbd 's VBA "immediate" window, but it won't work in a click event.
If anyone out there can preserve my sanity, I'd much appreciate it. Thanks!
-DW
|