By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,829 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,829 IT Pros & Developers. It's quick & easy.

User-defined type not defined

P: n/a
Hi everyone,

I have an error message in an Access 97 database & I was hoping
someone may be able to help me get rid of it (bearing in mind I only
have an average understanding of Access & absolutely none of VB
coding). Originally, this database was in Access 2003 format. I opened
it in 2003, then used the convert option to back it down to Access 97.
I then opened it in 97. Upon opening, I get this error message:
"compile error: user-defined type not defined". When I click ok, I am
taken to a screen with a window title of "form_switchboard", with some
code in it. "Private Sub FillOptions()" is highlighted in yellow, with
an arrow beside it. Just below this is a line "Dim dbs As Database",
with the "dbs As Database" part highlighted in blue. I can then click
on the "end" button on the Access toolbar, & I will be taken back to
the screen which shows the box with the
tables/queries/forms/reports/macros/modules tabs. I have discovered
that removing the switchboard gets rid of the error. Even creating a
new switchboard after removing the original one causes the error
message. All the switchboard consists of is two buttons, one opening a
form in add mode, the other opening it in edit mode. Yet, after
removing the switchboard, I can still open the relevant form without
error, so I'm assuming that somehow, something in the switchboard code
is the problem. So, can anyone tell me what the problem is, & how I
might be able to fix it?

Thanks,

CM
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
eh***********@yahoo.com (Chris) wrote:
Upon opening, I get this error message:
"compile error: user-defined type not defined". When I click ok, I am
taken to a screen with a window title of "form_switchboard", with some
code in it. "Private Sub FillOptions()" is highlighted in yellow, with
an arrow beside it. Just below this is a line "Dim dbs As Database",
with the "dbs As Database" part highlighted in blue.


This switchboard was created using the switchboard add-in. I've never tried
back-pedalling through Access versions but I imagine that an app created in
v2kx will contain lots of code that A97 can't handle. Just a thought
though, try changing "Dim dbs As Database" to "Dim dbs As DAO.Database".

Regards,
Keith.
Nov 13 '05 #2

P: n/a
Database comes from the DAO library. With any module open, select Tools |
References from the menu bar.
You need to ensure that the Microsoft DAO 3.5x Object Library reference is
checked.

While you're there, though, you might as well check whether there are any
other References problems (they're very common when switching versions of
software)

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Chris" <eh***********@yahoo.com> wrote in message
news:bc**************************@posting.google.c om...
Hi everyone,

I have an error message in an Access 97 database & I was hoping
someone may be able to help me get rid of it (bearing in mind I only
have an average understanding of Access & absolutely none of VB
coding). Originally, this database was in Access 2003 format. I opened
it in 2003, then used the convert option to back it down to Access 97.
I then opened it in 97. Upon opening, I get this error message:
"compile error: user-defined type not defined". When I click ok, I am
taken to a screen with a window title of "form_switchboard", with some
code in it. "Private Sub FillOptions()" is highlighted in yellow, with
an arrow beside it. Just below this is a line "Dim dbs As Database",
with the "dbs As Database" part highlighted in blue. I can then click
on the "end" button on the Access toolbar, & I will be taken back to
the screen which shows the box with the
tables/queries/forms/reports/macros/modules tabs. I have discovered
that removing the switchboard gets rid of the error. Even creating a
new switchboard after removing the original one causes the error
message. All the switchboard consists of is two buttons, one opening a
form in add mode, the other opening it in edit mode. Yet, after
removing the switchboard, I can still open the relevant form without
error, so I'm assuming that somehow, something in the switchboard code
is the problem. So, can anyone tell me what the problem is, & how I
might be able to fix it?

Thanks,

CM

Nov 13 '05 #3

P: n/a
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message news:<%M******************@news04.bloor.is.net.cab le.rogers.com>...
Database comes from the DAO library. With any module open, select Tools |
References from the menu bar.
You need to ensure that the Microsoft DAO 3.5x Object Library reference is
checked.


Hi everyone,

Thanks for the replies. I gave both Keith's & Doug's suggestions a go.
Changing the "Dim dbs As Database" to "Dim dbs As DAO.Database" as per
Keith's suggestion didn't work - I just got the same message. I then
tried going into Reference's as Doug suggested. I ticked the Microsoft
DAO 3.51 entry, & then closed & opened the database again. Well, the
original "user-defined" error has now gone, but there is a new error.
Upon opening the database, I get a "run time error 13: type mismatch"
error message. When I click debug, I get the same "form_switchboard"
screen as in the original error. This time however, the phrase "Set
rst = dbs.OpenRecordset(strSQL)" is highlighted in yellow (with an
arrow beside it). This is under the same heading as the original error
message (ie "Private Sub FillOptions()"). It seems progress has been
made, but can anyone help me decode this error?

CM
Nov 13 '05 #4

P: n/a
> Thanks for the replies. I gave both Keith's & Doug's suggestions a go.
Changing the "Dim dbs As Database" to "Dim dbs As DAO.Database" as per
Keith's suggestion didn't work - I just got the same message. I then
tried going into Reference's as Doug suggested. I ticked the Microsoft
DAO 3.51 entry, & then closed & opened the database again. Well, the
original "user-defined" error has now gone, but there is a new error.
Upon opening the database, I get a "run time error 13: type mismatch"
error message. When I click debug, I get the same "form_switchboard"
screen as in the original error. This time however, the phrase "Set
rst = dbs.OpenRecordset(strSQL)" is highlighted in yellow (with an
arrow beside it). This is under the same heading as the original error
message (ie "Private Sub FillOptions()"). It seems progress has been
made, but can anyone help me decode this error?


Both the ADO and DAO Object models support a Recordset object. I'm
guessing that you have a reference to ADO (Microsoft ActiveX Data
Object 2.x) that appears higher than your DAO reference in your
reference list so without specifying which to use the compiler uses
the first one in the list (ADODB) causing the "type mismatch" error.

You can either remove the ADO reference, move it lower in the list
than the DAO reference or (best solution) declare that you want a DAO
recordset in your code by declaring it as so:

Dim rst As DAO.Recordset

The reason that the DAO. prefix had no effect when declaring the
Database object is that only DAO has a Database object so there was no
ambiguity.

'---------------
' John Mishefske
'---------------
Nov 13 '05 #5

P: n/a
mi****@execpc.com (almish) wrote in message news:<95**************************@posting.google. com>...
Both the ADO and DAO Object models support a Recordset object. I'm
guessing that you have a reference to ADO (Microsoft ActiveX Data
Object 2.x) that appears higher than your DAO reference in your
reference list so without specifying which to use the compiler uses
the first one in the list (ADODB) causing the "type mismatch" error.

You can either remove the ADO reference, move it lower in the list
than the DAO reference or (best solution) declare that you want a DAO
recordset in your code by declaring it as so:

Dim rst As DAO.Recordset

The reason that the DAO. prefix had no effect when declaring the
Database object is that only DAO has a Database object so there was no
ambiguity.


Awesome! Thanks John, that did the trick. I wasn't sure where to put
the code that you said would be the best solution, so I simply moved
that ActiveX Data Object one space lower than the DAO Object. I am now
able to open the database without errors, switchboard enabled & all!
:-) I'm not a big database designing person (I have only made 2), so
I'm not sure what (if any) effect this change will have on Access, so
hopefully what I did won't cause any errors in the other database I
made. I have opened it to have a quick check, & all seems ok, so I
will keep my fingers crossed.

Regards,

CM
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.