A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

In Access 2000 this doesn't work" Dim db As Database" what do I u.



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2004, 12:29 PM
Vickyav
external usenet poster
 
Posts: n/a
Default In Access 2000 this doesn't work" Dim db As Database" what do I u.

In Access 97 I used this statement to open a record set...
Dim db As Database

I get an error on this portion and can't go any further. Can someone help me?
  #2  
Old November 20th, 2004, 02:13 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

"Vickyav" wrote in message
news
In Access 97 I used this statement to open a record set...
Dim db As Database

I get an error on this portion and can't go any further. Can someone help me?


"Database" is a DAO object. Access 97 and Access 2003 include a reference to
the DAO library by default. Access 2000 and Access 2002 do not so you have to
add it yourself.

While in the VBA window, go to Tools - References. Scan down the list until you
find the DAO 3.6 library and check it. If you don't plan on using the ADO
library that will already be checked by default then uncheck it. You can have
them both checked, but there are a handful of objects that exist in both
libraries so you would have to disambiguate them in your code by (for example),
using DAO.Recordset instead of just Recordset.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #3  
Old November 20th, 2004, 03:29 PM
Vickyav
external usenet poster
 
Posts: n/a
Default

Thanks. It partially answered my question, but the code still doesn't work.
I've just begun to use 2000. Here is the code, can you tell me what is wrong?
It opens the same recordset twice. It loops to see if a beginning date is
null, if so, it puts that end date in the crrect end date of the first
recordset. It worked fine in 97
Private Sub Form_Load()
Dim db As DAO.Database

Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset

Set db = CurrentDb

Set rst1 = db.OpenRecordset("t_primary_correct")
Set rst2 = db.OpenRecordset("t_primary_correct")

rst1.MoveFirst
rst2.MoveFirst
rst1.MoveNext
Do
If rst2![Client_ID] = rst1![Client_ID] And _
rst2![id] rst1![id] And _
IsNull(rst2![Restraint_Begin_Date]) Then
With rst1
.Edit
rst1![crrect_end date] = rst2![Restraint_End_Date]

.Update

End With
Else
rst1.MoveNext
With rst1
.Edit
rst1![crrect_end date] = rst1![Restraint_End_Date]
.Update
End With
End If

rst1.MoveNext
rst2.MoveNext
Loop Until rst1.EOF

End Sub


"Rick Brandt" wrote:

"Vickyav" wrote in message
news
In Access 97 I used this statement to open a record set...
Dim db As Database

I get an error on this portion and can't go any further. Can someone help me?


"Database" is a DAO object. Access 97 and Access 2003 include a reference to
the DAO library by default. Access 2000 and Access 2002 do not so you have to
add it yourself.

While in the VBA window, go to Tools - References. Scan down the list until you
find the DAO 3.6 library and check it. If you don't plan on using the ADO
library that will already be checked by default then uncheck it. You can have
them both checked, but there are a handful of objects that exist in both
libraries so you would have to disambiguate them in your code by (for example),
using DAO.Recordset instead of just Recordset.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



  #4  
Old November 20th, 2004, 03:41 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

"Vickyav" wrote in message
...
Thanks. It partially answered my question, but the code still doesn't work.
I've just begun to use 2000. Here is the code, can you tell me what is wrong?
It opens the same recordset twice. It loops to see if a beginning date is
null, if so, it puts that end date in the crrect end date of the first
recordset. It worked fine in 97 [SNIP]


I'm afraid you'll have to define "doesn't work".

Does the code not compile?
Do you get errors when you run it?
Does it run, but with incorrect results?


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #5  
Old November 20th, 2004, 03:49 PM
Vickyav
external usenet poster
 
Posts: n/a
Default

It doesn't run. The form opens and nothing runs.

"Rick Brandt" wrote:

"Vickyav" wrote in message
...
Thanks. It partially answered my question, but the code still doesn't work.
I've just begun to use 2000. Here is the code, can you tell me what is wrong?
It opens the same recordset twice. It loops to see if a beginning date is
null, if so, it puts that end date in the crrect end date of the first
recordset. It worked fine in 97 [SNIP]


I'm afraid you'll have to define "doesn't work".

Does the code not compile?
Do you get errors when you run it?
Does it run, but with incorrect results?


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



  #6  
Old November 20th, 2004, 03:56 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

"Vickyav" wrote in message
...
It doesn't run. The form opens and nothing runs.


Are you sure that the OnLoad property has "[Event Procedure]" entered in it?

Have you tried inserting a break point to see if the code is even being
executed?


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #7  
Old November 20th, 2004, 05:39 PM
Vickyav
external usenet poster
 
Posts: n/a
Default

yes. to both questions. the last part has begun to work, but it is entering
the date to the wrong record, so I have it written wrong obviously.
if you see a mistake, let me know. Thanks so much for your help.

"Rick Brandt" wrote:

"Vickyav" wrote in message
...
It doesn't run. The form opens and nothing runs.


Are you sure that the OnLoad property has "[Event Procedure]" entered in it?

Have you tried inserting a break point to see if the code is even being
executed?


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to open 2003 Access database in 2000 Access. Kathy General Discussion 3 November 10th, 2004 06:30 PM
Access 2000 database MFoster General Discussion 3 October 1st, 2004 02:47 AM
Word 2000/2002 - Proper Mail Merge steps for ODBC? Tony_VBACoder Mailmerge 7 September 2nd, 2004 09:21 PM
Access 2000 database password Lewis General Discussions 2 June 3rd, 2004 07:24 AM


All times are GMT +1. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.