Compile error: User-defined type not defined

  • Follow


HiThis error popped up on this line of code:Dim db as DatabaseApart from the obvious self contradiction (defined .. not defined),what can possibly be wrong with this statement. I have used it beforein numerous other projects?Stapes
0
Reply Stapes 3/7/2007 5:29:01 PM

On Mar 7, 1:29 pm, "Stapes" <steve.sta...@gmail.com> wrote:> Hi>> This error popped up on this line of code:>> Dim db as Database>> Apart from the obvious self contradiction (defined .. not defined),> what can possibly be wrong with this statement. I have used it before> in numerous other projects?>> StapesDepending on the version of Access you are using, you may need tocheck the references and see if the DAO 3.xx, or ADO libraries areselected and available. If both are available, you may need toexplicitly define which library to use.Dim db As DAO.Database
0
Reply storrboy 3/7/2007 5:37:19 PM


"storrboy" <storrboy@sympatico.ca> wrote in message news:1173289039.650812.118420@v33g2000cwv.googlegroups.com...> On Mar 7, 1:29 pm, "Stapes" <steve.sta...@gmail.com> wrote:>> Hi>>>> This error popped up on this line of code:>>>> Dim db as Database>>>> Apart from the obvious self contradiction (defined .. not defined),>> what can possibly be wrong with this statement. I have used it before>> in numerous other projects?>> Depending on the version of Access you are using, you may need to> check the references and see if the DAO 3.xx, or ADO libraries are> selected and available. If both are available, you may need to> explicitly define which library to use.>> Dim db As DAO.DatabaseThe Database object only exists in DAO, not ADO. The fact that it's being flagged as "not defined" implies that no reference has been set to DAO.From within the VB Editor, select Tools | References. Scroll through the list of available references until you find Microsoft.DAO 3.6 Object Library, check it, and click on the OK button. If you've got references set to both ADO and DAO, ensure you're properly disambiguating references to objects that do exist in both models (such as Recordset: you need either As DAO.Recordset or As ADODB.Recordset)-- Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele(no e-mails, please!)
0
Reply Douglas 3/7/2007 5:47:48 PM

On 7 Mar, 17:37, "storrboy" <storr...@sympatico.ca> wrote:> On Mar 7, 1:29 pm, "Stapes" <steve.sta...@gmail.com> wrote:>> > Hi>> > This error popped up on this line of code:>> > Dim db as Database>> > Apart from the obvious self contradiction (defined .. not defined),> > what can possibly be wrong with this statement. I have used it before> > in numerous other projects?>> > Stapes>> Depending on the version of Access you are using, you may need to> check the referencesWhat references, where ?and see if the DAO 3.xx, or ADO libraries are> selected and available. If both are available, you may need to> explicitly define which library to use.>> Dim db As DAO.Database
0
Reply Stapes 3/7/2007 5:49:59 PM

3 Replies
488 Views

(page loaded in 0.081 seconds)

Similiar Articles:
















7/22/2012 1:51:23 PM


Reply: