PC Review


Reply
Thread Tools Rate Thread

Basic Function Not Defined

 
 
Nick
Guest
Posts: n/a
 
      8th Jul 2008
I recently changed jobs and I'm trying to run a database I used a few years
ago. I haven't changed a thing, and I'm getting a compile error when I first
open it on the following code:

The Compile error points to the Max function below...

Public Function DateConfigure(MaxMasterTableRowDate As Date)

Dim CMSrst As DAO.Recordset
Dim db1 As DAO.Database
Dim MaxDateInSourceData As Date

'check table name
Set db1 = CurrentDb()

Set CMSrst = db1.OpenRecordset("root_hsplit", dbOpenDynaset)

MaxDateInSourceData = Max(CMSrst.Fields(0)) ' --> Compile error here....

If MaxMasterTableRowDate = MaxDateInSourceData Then
DateConfigure = MaxMasterTableRowDate
Else
DateConfigure = MaxDateInSourceData
End If
End Function

I can't figure out why?? I have all of the basic references setup, and none
are labeled "MISSING". Someone please advise?

Thanks,
Nick
 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      8th Jul 2008
Hi,
there is no Max function, also there is no sense to get Max from one value
Perhaps you need to use DMax() to get max of a field in a table

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"Nick" <(E-Mail Removed)> wrote in message
news:78906E7F-8626-413E-9AC2-(E-Mail Removed)...
>I recently changed jobs and I'm trying to run a database I used a few years
> ago. I haven't changed a thing, and I'm getting a compile error when I
> first
> open it on the following code:
>
> The Compile error points to the Max function below...
>
> Public Function DateConfigure(MaxMasterTableRowDate As Date)
>
> Dim CMSrst As DAO.Recordset
> Dim db1 As DAO.Database
> Dim MaxDateInSourceData As Date
>
> 'check table name
> Set db1 = CurrentDb()
>
> Set CMSrst = db1.OpenRecordset("root_hsplit", dbOpenDynaset)
>
> MaxDateInSourceData = Max(CMSrst.Fields(0)) ' --> Compile error here....
>
> If MaxMasterTableRowDate = MaxDateInSourceData Then
> DateConfigure = MaxMasterTableRowDate
> Else
> DateConfigure = MaxDateInSourceData
> End If
> End Function
>
> I can't figure out why?? I have all of the basic references setup, and
> none
> are labeled "MISSING". Someone please advise?
>
> Thanks,
> Nick


 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      8th Jul 2008
Max() is not in the basic libraries.

Do you have a Max()?

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Nick" <(E-Mail Removed)> wrote in message
news:78906E7F-8626-413E-9AC2-(E-Mail Removed)...
>I recently changed jobs and I'm trying to run a database I used a few years
> ago. I haven't changed a thing, and I'm getting a compile error when I
> first
> open it on the following code:
>
> The Compile error points to the Max function below...
>
> Public Function DateConfigure(MaxMasterTableRowDate As Date)
>
> Dim CMSrst As DAO.Recordset
> Dim db1 As DAO.Database
> Dim MaxDateInSourceData As Date
>
> 'check table name
> Set db1 = CurrentDb()
>
> Set CMSrst = db1.OpenRecordset("root_hsplit", dbOpenDynaset)
>
> MaxDateInSourceData = Max(CMSrst.Fields(0)) ' --> Compile error here....
>
> If MaxMasterTableRowDate = MaxDateInSourceData Then
> DateConfigure = MaxMasterTableRowDate
> Else
> DateConfigure = MaxDateInSourceData
> End If
> End Function
>
> I can't figure out why?? I have all of the basic references setup, and
> none
> are labeled "MISSING". Someone please advise?
>
> Thanks,
> Nick


 
Reply With Quote
 
Nick
Guest
Posts: n/a
 
      8th Jul 2008
I don't have a Max, I can't figure out what is going on....changed to DMax,
it compiles now, I'll see soon if it works....thanks.



"Alex Dybenko" wrote:

> Hi,
> there is no Max function, also there is no sense to get Max from one value
> Perhaps you need to use DMax() to get max of a field in a table
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
> "Nick" <(E-Mail Removed)> wrote in message
> news:78906E7F-8626-413E-9AC2-(E-Mail Removed)...
> >I recently changed jobs and I'm trying to run a database I used a few years
> > ago. I haven't changed a thing, and I'm getting a compile error when I
> > first
> > open it on the following code:
> >
> > The Compile error points to the Max function below...
> >
> > Public Function DateConfigure(MaxMasterTableRowDate As Date)
> >
> > Dim CMSrst As DAO.Recordset
> > Dim db1 As DAO.Database
> > Dim MaxDateInSourceData As Date
> >
> > 'check table name
> > Set db1 = CurrentDb()
> >
> > Set CMSrst = db1.OpenRecordset("root_hsplit", dbOpenDynaset)
> >
> > MaxDateInSourceData = Max(CMSrst.Fields(0)) ' --> Compile error here....
> >
> > If MaxMasterTableRowDate = MaxDateInSourceData Then
> > DateConfigure = MaxMasterTableRowDate
> > Else
> > DateConfigure = MaxDateInSourceData
> > End If
> > End Function
> >
> > I can't figure out why?? I have all of the basic references setup, and
> > none
> > are labeled "MISSING". Someone please advise?
> >
> > Thanks,
> > Nick

>
>

 
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
Excel - User Defined Function Error: This function takes no argume =?Utf-8?B?QnJ1Y2VJbkNhbGdhcnk=?= Microsoft Excel Programming 3 23rd Aug 2006 09:53 PM
Microsoft Visual Basic: Compile error: Sum or Function not defined Dmitry Microsoft Excel Discussion 13 3rd Apr 2006 08:28 AM
Microsoft Visual Basic: Compile error: Sum or Function not defined Dmitry Microsoft Excel Programming 13 3rd Apr 2006 08:28 AM
Microsoft Visual Basic: Compile error: Sum or Function not defined Dmitry Microsoft Excel Worksheet Functions 13 3rd Apr 2006 08:28 AM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Microsoft Excel Programming 1 6th Aug 2003 10:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:07 PM.