difference of dates

G

Guest

how to find out difference between 2 dates without calculating weekends i.e.
2 days

thanks
 
G

Guest

thanks, the first code was helpful

when I tried the second set of codes it give me error
compile error
user defined type not defined
and it points at Dim rst As DAO.Recordset

plz advise
 
D

Douglas J Steele

Sounds as though you're using Access 2000 or 2002.

By default, they only have a reference set for ADO. With any code module
open, select Tools | References from the menu bar, scroll through the list
of available references until you find the one for Microsoft DAO 3.6 Object
Library, select it and back out of the dialog.
 
G

Guest

thanks for that u are right, so I used
Dim rst As Recordset
Dim cnn As ADODB.Connection and it works though got stuck at "If rst.NoMatch"
saying,
compile error
method or data member not found

can you tell me what is the alternate for NoMatch method

thanks
 
B

Brendan Reynolds

ADO doesn't have any direct equivalent of the NoMatch property. If the ADO
Find method does not find a match, the .EOF property of the recordset will
be true. For example ...

Public Sub TestAdoFind()

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst
Set .ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.Source = "SELECT LastName, FirstName FROM Employees"
.Open
.Find "LastName = 'Murphy'"
If .EOF Then
MsgBox "No Murphy in Employees"
Else
MsgBox "Murphy's given name is: " & .Fields("FirstName")
End If
.Close
End With

End Sub
 
D

Douglas J. Steele

Why not use DAO, like the KB uses?

Just follow the instructions that are in the KB article:

"NOTE: The sample code in this article uses Microsoft Data Access Objects.
For this code to run properly, you must reference the Microsoft DAO 3.6
Object Library. To do so, click References on the Tools menu in the Visual
Basic Editor, and make sure that the Microsoft DAO 3.6 Object Library check
box is selected."
 
G

Guest

Thanks, much appreciated.

Keycode value for PASSWORD IS 2818, how to have a list of keycode values for
other alphabets

Cheers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top