PC Review


Reply
Thread Tools Rate Thread

Definition of database variables

 
 
Ivano Venturi
Guest
Posts: n/a
 
      5th Jun 2009
In the MS Access 2003 User Guide is reported the following example about
AddNew method:

Dim dbsNorthwind As Database
Dim rstEmployees As Recordset

Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Set rstEmployees = dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)

As my database name is RegSIP_app.mdb, RegSIP_dat.mdb is the one where are
stored all the data tables and Tab_PreAmb is the name of the table in which I
have to add a new record when user clicks a button on a form stored in
RegSIP_app.mdb, I tried to write something like this:

Dim dbsRegSIP As Database
Dim rstPreAmb As Recordset

Set dbsRegSIP = OpenDatabase("g:\RegSIP\RegSIP_dat.mdb")
Set rstPreAmb = dbsRegSIP.OpenRecordset("Tab_PreAmb", dbOpenDynaset)

I have MS Access 2003 SP3 and it does not work at all ! :-S I mean ... it
gives me a compilation error saying that the user defined type is not defined
!?! Can someone help me to find where is my mistake ?!? Thank you very much
in advance !

Greetings from Modena,
Emilia-Romagna - Italy.

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      5th Jun 2009
While in the VB Editor, select Tools | References from the menu. If
Microsoft DAO 3.6 Object Library isn't one of the selected references,
scroll through the list until you find it and select it. If it is one of the
selected references, do any of the other selected references have MISSING:
in front of them?

Oh, and change your declaration from

Dim rstEmployees As Recordset

to

Dim rstEmployees As DAO.Recordset


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Ivano Venturi" <(E-Mail Removed)> wrote in message
news:BD719AC0-E5BF-41A8-BE92-(E-Mail Removed)...
> In the MS Access 2003 User Guide is reported the following example about
> AddNew method:
>
> Dim dbsNorthwind As Database
> Dim rstEmployees As Recordset
>
> Set dbsNorthwind = OpenDatabase("Northwind.mdb")
> Set rstEmployees = dbsNorthwind.OpenRecordset("Employees",
> dbOpenDynaset)
>
> As my database name is RegSIP_app.mdb, RegSIP_dat.mdb is the one where are
> stored all the data tables and Tab_PreAmb is the name of the table in
> which I
> have to add a new record when user clicks a button on a form stored in
> RegSIP_app.mdb, I tried to write something like this:
>
> Dim dbsRegSIP As Database
> Dim rstPreAmb As Recordset
>
> Set dbsRegSIP = OpenDatabase("g:\RegSIP\RegSIP_dat.mdb")
> Set rstPreAmb = dbsRegSIP.OpenRecordset("Tab_PreAmb", dbOpenDynaset)
>
> I have MS Access 2003 SP3 and it does not work at all ! :-S I mean ... it
> gives me a compilation error saying that the user defined type is not
> defined
> !?! Can someone help me to find where is my mistake ?!? Thank you very
> much
> in advance !
>
> Greetings from Modena,
> Emilia-Romagna - Italy.
>



 
Reply With Quote
 
Ivano Venturi
Guest
Posts: n/a
 
      19th Jun 2009
Well done ! Microsoft DAO 3.6 Object Library was not one of the selected
references ... :-S Now I have selected it and it seems to work fine ... thank
you very much ! ;-)

Greetings from Modena,
Emilia-Romagna - Italy.

"Douglas J. Steele" wrote:

> While in the VB Editor, select Tools | References from the menu. If
> Microsoft DAO 3.6 Object Library isn't one of the selected references,
> scroll through the list until you find it and select it. If it is one of the
> selected references, do any of the other selected references have MISSING:
> in front of them?
>
> Oh, and change your declaration from
>
> Dim rstEmployees As Recordset
>
> to
>
> Dim rstEmployees As DAO.Recordset
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Ivano Venturi" <(E-Mail Removed)> wrote in message
> news:BD719AC0-E5BF-41A8-BE92-(E-Mail Removed)...
> > In the MS Access 2003 User Guide is reported the following example about
> > AddNew method:
> >
> > Dim dbsNorthwind As Database
> > Dim rstEmployees As Recordset
> >
> > Set dbsNorthwind = OpenDatabase("Northwind.mdb")
> > Set rstEmployees = dbsNorthwind.OpenRecordset("Employees",
> > dbOpenDynaset)
> >
> > As my database name is RegSIP_app.mdb, RegSIP_dat.mdb is the one where are
> > stored all the data tables and Tab_PreAmb is the name of the table in
> > which I
> > have to add a new record when user clicks a button on a form stored in
> > RegSIP_app.mdb, I tried to write something like this:
> >
> > Dim dbsRegSIP As Database
> > Dim rstPreAmb As Recordset
> >
> > Set dbsRegSIP = OpenDatabase("g:\RegSIP\RegSIP_dat.mdb")
> > Set rstPreAmb = dbsRegSIP.OpenRecordset("Tab_PreAmb", dbOpenDynaset)
> >
> > I have MS Access 2003 SP3 and it does not work at all ! :-S I mean ... it
> > gives me a compilation error saying that the user defined type is not
> > defined
> > !?! Can someone help me to find where is my mistake ?!? Thank you very
> > much
> > in advance !
> >
> > Greetings from Modena,
> > Emilia-Romagna - Italy.
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Export database definition only Wendy Microsoft Access 0 2nd Feb 2009 09:53 AM
Scope of Database Definition cmdex_VABCH via AccessMonster.com Microsoft Access Database Table Design 2 12th Dec 2007 08:58 PM
Storing control definition in database... Charlie@CBFC Microsoft ASP .NET 1 5th Feb 2007 08:35 PM
Definition and use of multi-dimensional variables Arthur Negus via OfficeKB.com Microsoft Excel Programming 3 20th Nov 2006 08:19 PM
Object definition and structure, with variables =?Utf-8?B?TmVhbCBaaW1t?= Microsoft Excel Programming 6 24th Feb 2005 09:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:06 PM.