Sandesh555
asked on
Use of DMax in Excel not working./
Hi Team,
the given below code is not working form me. Can you please help.
the given below code is not working form me. Can you please help.
Private Sub RecTimeAddition()
'Database Declariation
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim dblDocID As Double
'Database Connection
Set db = OpenDatabase("DatebasePath.mdb")
Set rs = db.OpenRecordset("tblRecevied", dbOpenTable)
'Get the Doc ID
dblDocID = DMax("rs.[tblRecevied].[DocID]", "rs.[tblRecevied]")
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As I understand it (I've never used it) DMAX works on a "database" consisting of a range of cells in Excel, rather than an Access database. Here's an example.
Looking at the code I gave you and the one you provided, I see you have tblReceived spelled as tblRecevied, so you need to adjust accordingly.
dblDocID = DMax(rs.[tblRecevied].[Doc
Note: That way you are not getting the results from the recordset for the DMAX function but using that as strings