Group:  Microsoft Access ยป microsoft.public.access.gettingstarted
Thread: Module not working

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Module not working
Dwayne Struble 27.09.2006 12:19:01
I am a new Access user, and am using access 97. I am working on setting up a
callout list where the order is determined by overtime hours worked. I set
upa query that adds the hours at start of pay period with the hours worked
and gets total then sorts it. I then need it to show the updated place in
the order. I found a funtion that does that in another post here, but when I
put the funtion in a module and called it in the query, I get an error
stating undefined funtion. Thanks for your help.
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 27.09.2006 13:06:12
You'll have to provide a little more detail in order for us to be able to
help.

First, are you talking about a "true" module (one that you get to through
the Modules tab), as opposed to a module associated with a form or report?

Assuming it's a true module, how did you declare the function (i.e.:
hopefully you don't have the keyword Private in front of the Function
declaration), and how are you trying to call it?


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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:D4C834FC-B873-4954-804A-0A3724D3B68B[ at ]microsoft.com...
[Quoted Text]
>I am a new Access user, and am using access 97. I am working on setting up
>a
> callout list where the order is determined by overtime hours worked. I
> set
> upa query that adds the hours at start of pay period with the hours
> worked
> and gets total then sorts it. I then need it to show the updated place in
> the order. I found a funtion that does that in another post here, but
> when I
> put the funtion in a module and called it in the query, I get an error
> stating undefined funtion. Thanks for your help.


RE: Module not working
Barry Gilbert 27.09.2006 13:11:11
Functions called from queries need to be public functions saved to a module.
Could you post your code and the SQL from your query?

Barry

"Dwayne Struble" wrote:

[Quoted Text]
> I am a new Access user, and am using access 97. I am working on setting up a
> callout list where the order is determined by overtime hours worked. I set
> upa query that adds the hours at start of pay period with the hours worked
> and gets total then sorts it. I then need it to show the updated place in
> the order. I found a funtion that does that in another post here, but when I
> put the funtion in a module and called it in the query, I get an error
> stating undefined funtion. Thanks for your help.
RE: Module not working
Dwayne Struble 27.09.2006 13:40:02
Here is the module I am trying to use.

Function Serialize(qryname As String, keyname As String, keyvalue) As Long

Dim rs As Recordset


On Error GoTo Err_Serialize

Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)

rs.FindFirst Application.BuildCriteria(keyname, rs.Fields(keyname).Type,
keyvalue)

Serialize = Nz(rs.AbsolutePosition, -1) + 1


Err_Serialize:

rs.Close

Set rs = Nothing

End Function


Here is how I am trying to call it in a query.


Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])

Thanks,
Dwayne


"Barry Gilbert" wrote:

[Quoted Text]
> Functions called from queries need to be public functions saved to a module.
> Could you post your code and the SQL from your query?
>
> Barry
>
> "Dwayne Struble" wrote:
>
> > I am a new Access user, and am using access 97. I am working on setting up a
> > callout list where the order is determined by overtime hours worked. I set
> > upa query that adds the hours at start of pay period with the hours worked
> > and gets total then sorts it. I then need it to show the updated place in
> > the order. I found a funtion that does that in another post here, but when I
> > put the funtion in a module and called it in the query, I get an error
> > stating undefined funtion. Thanks for your help.
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 27.09.2006 13:48:52
How are you calling the query? Is it through code, or are you simply
double-clicking on the query to open it? If you're opening it through code,
what's that code.

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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
[Quoted Text]
> Here is the module I am trying to use.
>
> Function Serialize(qryname As String, keyname As String, keyvalue) As Long
>
> Dim rs As Recordset
>
>
> On Error GoTo Err_Serialize
>
> Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
>
> rs.FindFirst Application.BuildCriteria(keyname, rs.Fields(keyname).Type,
> keyvalue)
>
> Serialize = Nz(rs.AbsolutePosition, -1) + 1
>
>
> Err_Serialize:
>
> rs.Close
>
> Set rs = Nothing
>
> End Function
>
>
> Here is how I am trying to call it in a query.
>
>
> Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])
>
> Thanks,
> Dwayne
>
>
> "Barry Gilbert" wrote:
>
>> Functions called from queries need to be public functions saved to a
>> module.
>> Could you post your code and the SQL from your query?
>>
>> Barry
>>
>> "Dwayne Struble" wrote:
>>
>> > I am a new Access user, and am using access 97. I am working on
>> > setting up a
>> > callout list where the order is determined by overtime hours worked. I
>> > set
>> > upa query that adds the hours at start of pay period with the hours
>> > worked
>> > and gets total then sorts it. I then need it to show the updated place
>> > in
>> > the order. I found a funtion that does that in another post here, but
>> > when I
>> > put the funtion in a module and called it in the query, I get an error
>> > stating undefined funtion. Thanks for your help.


Re: Module not working
Dwayne Struble 27.09.2006 14:33:01
Doug,

Since I am still setting up the database, I am running it after I save by
going from design view to datasheet view. Also I get the error when double
clicking on it.

Thanks,
Dwayne

"Douglas J. Steele" wrote:

[Quoted Text]
> How are you calling the query? Is it through code, or are you simply
> double-clicking on the query to open it? If you're opening it through code,
> what's that code.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
> > Here is the module I am trying to use.
> >
> > Function Serialize(qryname As String, keyname As String, keyvalue) As Long
> >
> > Dim rs As Recordset
> >
> >
> > On Error GoTo Err_Serialize
> >
> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
> >
> > rs.FindFirst Application.BuildCriteria(keyname, rs.Fields(keyname).Type,
> > keyvalue)
> >
> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
> >
> >
> > Err_Serialize:
> >
> > rs.Close
> >
> > Set rs = Nothing
> >
> > End Function
> >
> >
> > Here is how I am trying to call it in a query.
> >
> >
> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])
> >
> > Thanks,
> > Dwayne
> >
> >
> > "Barry Gilbert" wrote:
> >
> >> Functions called from queries need to be public functions saved to a
> >> module.
> >> Could you post your code and the SQL from your query?
> >>
> >> Barry
> >>
> >> "Dwayne Struble" wrote:
> >>
> >> > I am a new Access user, and am using access 97. I am working on
> >> > setting up a
> >> > callout list where the order is determined by overtime hours worked. I
> >> > set
> >> > upa query that adds the hours at start of pay period with the hours
> >> > worked
> >> > and gets total then sorts it. I then need it to show the updated place
> >> > in
> >> > the order. I found a funtion that does that in another post here, but
> >> > when I
> >> > put the funtion in a module and called it in the query, I get an error
> >> > stating undefined funtion. Thanks for your help.
>
>
>
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 27.09.2006 15:23:48
You didn't answer one of my earlier questions: are you talking about a
"true" module (one that you get to through
the Modules tab), as opposed to a module associated with a form or report?

I assume you've checked to ensure that you haven't mistyped the name of the
function in your query.

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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
[Quoted Text]
> Doug,
>
> Since I am still setting up the database, I am running it after I save by
> going from design view to datasheet view. Also I get the error when
> double
> clicking on it.
>
> Thanks,
> Dwayne
>
> "Douglas J. Steele" wrote:
>
>> How are you calling the query? Is it through code, or are you simply
>> double-clicking on the query to open it? If you're opening it through
>> code,
>> what's that code.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> message
>> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
>> > Here is the module I am trying to use.
>> >
>> > Function Serialize(qryname As String, keyname As String, keyvalue) As
>> > Long
>> >
>> > Dim rs As Recordset
>> >
>> >
>> > On Error GoTo Err_Serialize
>> >
>> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
>> >
>> > rs.FindFirst Application.BuildCriteria(keyname,
>> > rs.Fields(keyname).Type,
>> > keyvalue)
>> >
>> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
>> >
>> >
>> > Err_Serialize:
>> >
>> > rs.Close
>> >
>> > Set rs = Nothing
>> >
>> > End Function
>> >
>> >
>> > Here is how I am trying to call it in a query.
>> >
>> >
>> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])
>> >
>> > Thanks,
>> > Dwayne
>> >
>> >
>> > "Barry Gilbert" wrote:
>> >
>> >> Functions called from queries need to be public functions saved to a
>> >> module.
>> >> Could you post your code and the SQL from your query?
>> >>
>> >> Barry
>> >>
>> >> "Dwayne Struble" wrote:
>> >>
>> >> > I am a new Access user, and am using access 97. I am working on
>> >> > setting up a
>> >> > callout list where the order is determined by overtime hours worked.
>> >> > I
>> >> > set
>> >> > upa query that adds the hours at start of pay period with the hours
>> >> > worked
>> >> > and gets total then sorts it. I then need it to show the updated
>> >> > place
>> >> > in
>> >> > the order. I found a funtion that does that in another post here,
>> >> > but
>> >> > when I
>> >> > put the funtion in a module and called it in the query, I get an
>> >> > error
>> >> > stating undefined funtion. Thanks for your help.
>>
>>
>>


Re: Module not working
Dwayne Struble 27.09.2006 16:21:01
Doug,

Sorry, yes I made it a module in the module area. Yes I did verify my
spelling was consistant in both areas.

Dwayne

"Douglas J. Steele" wrote:

[Quoted Text]
> You didn't answer one of my earlier questions: are you talking about a
> "true" module (one that you get to through
> the Modules tab), as opposed to a module associated with a form or report?
>
> I assume you've checked to ensure that you haven't mistyped the name of the
> function in your query.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
> > Doug,
> >
> > Since I am still setting up the database, I am running it after I save by
> > going from design view to datasheet view. Also I get the error when
> > double
> > clicking on it.
> >
> > Thanks,
> > Dwayne
> >
> > "Douglas J. Steele" wrote:
> >
> >> How are you calling the query? Is it through code, or are you simply
> >> double-clicking on the query to open it? If you're opening it through
> >> code,
> >> what's that code.
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> message
> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
> >> > Here is the module I am trying to use.
> >> >
> >> > Function Serialize(qryname As String, keyname As String, keyvalue) As
> >> > Long
> >> >
> >> > Dim rs As Recordset
> >> >
> >> >
> >> > On Error GoTo Err_Serialize
> >> >
> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
> >> >
> >> > rs.FindFirst Application.BuildCriteria(keyname,
> >> > rs.Fields(keyname).Type,
> >> > keyvalue)
> >> >
> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
> >> >
> >> >
> >> > Err_Serialize:
> >> >
> >> > rs.Close
> >> >
> >> > Set rs = Nothing
> >> >
> >> > End Function
> >> >
> >> >
> >> > Here is how I am trying to call it in a query.
> >> >
> >> >
> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])
> >> >
> >> > Thanks,
> >> > Dwayne
> >> >
> >> >
> >> > "Barry Gilbert" wrote:
> >> >
> >> >> Functions called from queries need to be public functions saved to a
> >> >> module.
> >> >> Could you post your code and the SQL from your query?
> >> >>
> >> >> Barry
> >> >>
> >> >> "Dwayne Struble" wrote:
> >> >>
> >> >> > I am a new Access user, and am using access 97. I am working on
> >> >> > setting up a
> >> >> > callout list where the order is determined by overtime hours worked.
> >> >> > I
> >> >> > set
> >> >> > upa query that adds the hours at start of pay period with the hours
> >> >> > worked
> >> >> > and gets total then sorts it. I then need it to show the updated
> >> >> > place
> >> >> > in
> >> >> > the order. I found a funtion that does that in another post here,
> >> >> > but
> >> >> > when I
> >> >> > put the funtion in a module and called it in the query, I get an
> >> >> > error
> >> >> > stating undefined funtion. Thanks for your help.
> >>
> >>
> >>
>
>
>
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 27.09.2006 16:45:42
What happens if you go to the Immediate window (Ctrl-G), type

?Serialize("OPS Communicators","OT Hours End",xxx)

(replacing xxx with a legitimate value) and hit Enter?

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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
[Quoted Text]
> Doug,
>
> Sorry, yes I made it a module in the module area. Yes I did verify my
> spelling was consistant in both areas.
>
> Dwayne
>
> "Douglas J. Steele" wrote:
>
>> You didn't answer one of my earlier questions: are you talking about a
>> "true" module (one that you get to through
>> the Modules tab), as opposed to a module associated with a form or
>> report?
>>
>> I assume you've checked to ensure that you haven't mistyped the name of
>> the
>> function in your query.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> message
>> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
>> > Doug,
>> >
>> > Since I am still setting up the database, I am running it after I save
>> > by
>> > going from design view to datasheet view. Also I get the error when
>> > double
>> > clicking on it.
>> >
>> > Thanks,
>> > Dwayne
>> >
>> > "Douglas J. Steele" wrote:
>> >
>> >> How are you calling the query? Is it through code, or are you simply
>> >> double-clicking on the query to open it? If you're opening it through
>> >> code,
>> >> what's that code.
>> >>
>> >> --
>> >> Doug Steele, Microsoft Access MVP
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> message
>> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
>> >> > Here is the module I am trying to use.
>> >> >
>> >> > Function Serialize(qryname As String, keyname As String, keyvalue)
>> >> > As
>> >> > Long
>> >> >
>> >> > Dim rs As Recordset
>> >> >
>> >> >
>> >> > On Error GoTo Err_Serialize
>> >> >
>> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
>> >> >
>> >> > rs.FindFirst Application.BuildCriteria(keyname,
>> >> > rs.Fields(keyname).Type,
>> >> > keyvalue)
>> >> >
>> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
>> >> >
>> >> >
>> >> > Err_Serialize:
>> >> >
>> >> > rs.Close
>> >> >
>> >> > Set rs = Nothing
>> >> >
>> >> > End Function
>> >> >
>> >> >
>> >> > Here is how I am trying to call it in a query.
>> >> >
>> >> >
>> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])
>> >> >
>> >> > Thanks,
>> >> > Dwayne
>> >> >
>> >> >
>> >> > "Barry Gilbert" wrote:
>> >> >
>> >> >> Functions called from queries need to be public functions saved to
>> >> >> a
>> >> >> module.
>> >> >> Could you post your code and the SQL from your query?
>> >> >>
>> >> >> Barry
>> >> >>
>> >> >> "Dwayne Struble" wrote:
>> >> >>
>> >> >> > I am a new Access user, and am using access 97. I am working on
>> >> >> > setting up a
>> >> >> > callout list where the order is determined by overtime hours
>> >> >> > worked.
>> >> >> > I
>> >> >> > set
>> >> >> > upa query that adds the hours at start of pay period with the
>> >> >> > hours
>> >> >> > worked
>> >> >> > and gets total then sorts it. I then need it to show the updated
>> >> >> > place
>> >> >> > in
>> >> >> > the order. I found a funtion that does that in another post
>> >> >> > here,
>> >> >> > but
>> >> >> > when I
>> >> >> > put the funtion in a module and called it in the query, I get an
>> >> >> > error
>> >> >> > stating undefined funtion. Thanks for your help.
>> >>
>> >>
>> >>
>>
>>
>>


Re: Module not working
Dwayne Struble 27.09.2006 17:07:01
Doug,

I get a compile error;
Expected: =

Thanks,
Dwayne


"Douglas J. Steele" wrote:

[Quoted Text]
> What happens if you go to the Immediate window (Ctrl-G), type
>
> ?Serialize("OPS Communicators","OT Hours End",xxx)
>
> (replacing xxx with a legitimate value) and hit Enter?
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
> news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
> > Doug,
> >
> > Sorry, yes I made it a module in the module area. Yes I did verify my
> > spelling was consistant in both areas.
> >
> > Dwayne
> >
> > "Douglas J. Steele" wrote:
> >
> >> You didn't answer one of my earlier questions: are you talking about a
> >> "true" module (one that you get to through
> >> the Modules tab), as opposed to a module associated with a form or
> >> report?
> >>
> >> I assume you've checked to ensure that you haven't mistyped the name of
> >> the
> >> function in your query.
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> message
> >> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
> >> > Doug,
> >> >
> >> > Since I am still setting up the database, I am running it after I save
> >> > by
> >> > going from design view to datasheet view. Also I get the error when
> >> > double
> >> > clicking on it.
> >> >
> >> > Thanks,
> >> > Dwayne
> >> >
> >> > "Douglas J. Steele" wrote:
> >> >
> >> >> How are you calling the query? Is it through code, or are you simply
> >> >> double-clicking on the query to open it? If you're opening it through
> >> >> code,
> >> >> what's that code.
> >> >>
> >> >> --
> >> >> Doug Steele, Microsoft Access MVP
> >> >> http://I.Am/DougSteele
> >> >> (no e-mails, please!)
> >> >>
> >> >>
> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
> >> >> > Here is the module I am trying to use.
> >> >> >
> >> >> > Function Serialize(qryname As String, keyname As String, keyvalue)
> >> >> > As
> >> >> > Long
> >> >> >
> >> >> > Dim rs As Recordset
> >> >> >
> >> >> >
> >> >> > On Error GoTo Err_Serialize
> >> >> >
> >> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
> >> >> >
> >> >> > rs.FindFirst Application.BuildCriteria(keyname,
> >> >> > rs.Fields(keyname).Type,
> >> >> > keyvalue)
> >> >> >
> >> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
> >> >> >
> >> >> >
> >> >> > Err_Serialize:
> >> >> >
> >> >> > rs.Close
> >> >> >
> >> >> > Set rs = Nothing
> >> >> >
> >> >> > End Function
> >> >> >
> >> >> >
> >> >> > Here is how I am trying to call it in a query.
> >> >> >
> >> >> >
> >> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours End])
> >> >> >
> >> >> > Thanks,
> >> >> > Dwayne
> >> >> >
> >> >> >
> >> >> > "Barry Gilbert" wrote:
> >> >> >
> >> >> >> Functions called from queries need to be public functions saved to
> >> >> >> a
> >> >> >> module.
> >> >> >> Could you post your code and the SQL from your query?
> >> >> >>
> >> >> >> Barry
> >> >> >>
> >> >> >> "Dwayne Struble" wrote:
> >> >> >>
> >> >> >> > I am a new Access user, and am using access 97. I am working on
> >> >> >> > setting up a
> >> >> >> > callout list where the order is determined by overtime hours
> >> >> >> > worked.
> >> >> >> > I
> >> >> >> > set
> >> >> >> > upa query that adds the hours at start of pay period with the
> >> >> >> > hours
> >> >> >> > worked
> >> >> >> > and gets total then sorts it. I then need it to show the updated
> >> >> >> > place
> >> >> >> > in
> >> >> >> > the order. I found a funtion that does that in another post
> >> >> >> > here,
> >> >> >> > but
> >> >> >> > when I
> >> >> >> > put the funtion in a module and called it in the query, I get an
> >> >> >> > error
> >> >> >> > stating undefined funtion. Thanks for your help.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 27.09.2006 18:28:12
A compile error, or an execution error?

Did you include the question mark at the beginning? What did you put for
xxx?

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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:E29EC40A-BB7B-4F36-87BB-84A7656E7EDF[ at ]microsoft.com...
[Quoted Text]
> Doug,
>
> I get a compile error;
> Expected: =
>
> Thanks,
> Dwayne
>
>
> "Douglas J. Steele" wrote:
>
>> What happens if you go to the Immediate window (Ctrl-G), type
>>
>> ?Serialize("OPS Communicators","OT Hours End",xxx)
>>
>> (replacing xxx with a legitimate value) and hit Enter?
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> message
>> news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
>> > Doug,
>> >
>> > Sorry, yes I made it a module in the module area. Yes I did verify my
>> > spelling was consistant in both areas.
>> >
>> > Dwayne
>> >
>> > "Douglas J. Steele" wrote:
>> >
>> >> You didn't answer one of my earlier questions: are you talking about a
>> >> "true" module (one that you get to through
>> >> the Modules tab), as opposed to a module associated with a form or
>> >> report?
>> >>
>> >> I assume you've checked to ensure that you haven't mistyped the name
>> >> of
>> >> the
>> >> function in your query.
>> >>
>> >> --
>> >> Doug Steele, Microsoft Access MVP
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> message
>> >> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
>> >> > Doug,
>> >> >
>> >> > Since I am still setting up the database, I am running it after I
>> >> > save
>> >> > by
>> >> > going from design view to datasheet view. Also I get the error when
>> >> > double
>> >> > clicking on it.
>> >> >
>> >> > Thanks,
>> >> > Dwayne
>> >> >
>> >> > "Douglas J. Steele" wrote:
>> >> >
>> >> >> How are you calling the query? Is it through code, or are you
>> >> >> simply
>> >> >> double-clicking on the query to open it? If you're opening it
>> >> >> through
>> >> >> code,
>> >> >> what's that code.
>> >> >>
>> >> >> --
>> >> >> Doug Steele, Microsoft Access MVP
>> >> >> http://I.Am/DougSteele
>> >> >> (no e-mails, please!)
>> >> >>
>> >> >>
>> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
>> >> >> > Here is the module I am trying to use.
>> >> >> >
>> >> >> > Function Serialize(qryname As String, keyname As String,
>> >> >> > keyvalue)
>> >> >> > As
>> >> >> > Long
>> >> >> >
>> >> >> > Dim rs As Recordset
>> >> >> >
>> >> >> >
>> >> >> > On Error GoTo Err_Serialize
>> >> >> >
>> >> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset,
>> >> >> > dbReadOnly)
>> >> >> >
>> >> >> > rs.FindFirst Application.BuildCriteria(keyname,
>> >> >> > rs.Fields(keyname).Type,
>> >> >> > keyvalue)
>> >> >> >
>> >> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
>> >> >> >
>> >> >> >
>> >> >> > Err_Serialize:
>> >> >> >
>> >> >> > rs.Close
>> >> >> >
>> >> >> > Set rs = Nothing
>> >> >> >
>> >> >> > End Function
>> >> >> >
>> >> >> >
>> >> >> > Here is how I am trying to call it in a query.
>> >> >> >
>> >> >> >
>> >> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours
>> >> >> > End])
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Dwayne
>> >> >> >
>> >> >> >
>> >> >> > "Barry Gilbert" wrote:
>> >> >> >
>> >> >> >> Functions called from queries need to be public functions saved
>> >> >> >> to
>> >> >> >> a
>> >> >> >> module.
>> >> >> >> Could you post your code and the SQL from your query?
>> >> >> >>
>> >> >> >> Barry
>> >> >> >>
>> >> >> >> "Dwayne Struble" wrote:
>> >> >> >>
>> >> >> >> > I am a new Access user, and am using access 97. I am working
>> >> >> >> > on
>> >> >> >> > setting up a
>> >> >> >> > callout list where the order is determined by overtime hours
>> >> >> >> > worked.
>> >> >> >> > I
>> >> >> >> > set
>> >> >> >> > upa query that adds the hours at start of pay period with the
>> >> >> >> > hours
>> >> >> >> > worked
>> >> >> >> > and gets total then sorts it. I then need it to show the
>> >> >> >> > updated
>> >> >> >> > place
>> >> >> >> > in
>> >> >> >> > the order. I found a funtion that does that in another post
>> >> >> >> > here,
>> >> >> >> > but
>> >> >> >> > when I
>> >> >> >> > put the funtion in a module and called it in the query, I get
>> >> >> >> > an
>> >> >> >> > error
>> >> >> >> > stating undefined funtion. Thanks for your help.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Re: Module not working
Dwayne Struble 28.09.2006 11:42:02
Doug,

I tried it with and without the question mark. I got compile errors both
times. With the question mark, I got the message; External name not defined.
Without question mark I got the message; Expected: =
I used [OT Hours End] as the xxx.

Thanks,
Dwayne

"Douglas J. Steele" wrote:

[Quoted Text]
> A compile error, or an execution error?
>
> Did you include the question mark at the beginning? What did you put for
> xxx?
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
> news:E29EC40A-BB7B-4F36-87BB-84A7656E7EDF[ at ]microsoft.com...
> > Doug,
> >
> > I get a compile error;
> > Expected: =
> >
> > Thanks,
> > Dwayne
> >
> >
> > "Douglas J. Steele" wrote:
> >
> >> What happens if you go to the Immediate window (Ctrl-G), type
> >>
> >> ?Serialize("OPS Communicators","OT Hours End",xxx)
> >>
> >> (replacing xxx with a legitimate value) and hit Enter?
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> message
> >> news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
> >> > Doug,
> >> >
> >> > Sorry, yes I made it a module in the module area. Yes I did verify my
> >> > spelling was consistant in both areas.
> >> >
> >> > Dwayne
> >> >
> >> > "Douglas J. Steele" wrote:
> >> >
> >> >> You didn't answer one of my earlier questions: are you talking about a
> >> >> "true" module (one that you get to through
> >> >> the Modules tab), as opposed to a module associated with a form or
> >> >> report?
> >> >>
> >> >> I assume you've checked to ensure that you haven't mistyped the name
> >> >> of
> >> >> the
> >> >> function in your query.
> >> >>
> >> >> --
> >> >> Doug Steele, Microsoft Access MVP
> >> >> http://I.Am/DougSteele
> >> >> (no e-mails, please!)
> >> >>
> >> >>
> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
> >> >> > Doug,
> >> >> >
> >> >> > Since I am still setting up the database, I am running it after I
> >> >> > save
> >> >> > by
> >> >> > going from design view to datasheet view. Also I get the error when
> >> >> > double
> >> >> > clicking on it.
> >> >> >
> >> >> > Thanks,
> >> >> > Dwayne
> >> >> >
> >> >> > "Douglas J. Steele" wrote:
> >> >> >
> >> >> >> How are you calling the query? Is it through code, or are you
> >> >> >> simply
> >> >> >> double-clicking on the query to open it? If you're opening it
> >> >> >> through
> >> >> >> code,
> >> >> >> what's that code.
> >> >> >>
> >> >> >> --
> >> >> >> Doug Steele, Microsoft Access MVP
> >> >> >> http://I.Am/DougSteele
> >> >> >> (no e-mails, please!)
> >> >> >>
> >> >> >>
> >> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> >> >> message
> >> >> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
> >> >> >> > Here is the module I am trying to use.
> >> >> >> >
> >> >> >> > Function Serialize(qryname As String, keyname As String,
> >> >> >> > keyvalue)
> >> >> >> > As
> >> >> >> > Long
> >> >> >> >
> >> >> >> > Dim rs As Recordset
> >> >> >> >
> >> >> >> >
> >> >> >> > On Error GoTo Err_Serialize
> >> >> >> >
> >> >> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset,
> >> >> >> > dbReadOnly)
> >> >> >> >
> >> >> >> > rs.FindFirst Application.BuildCriteria(keyname,
> >> >> >> > rs.Fields(keyname).Type,
> >> >> >> > keyvalue)
> >> >> >> >
> >> >> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
> >> >> >> >
> >> >> >> >
> >> >> >> > Err_Serialize:
> >> >> >> >
> >> >> >> > rs.Close
> >> >> >> >
> >> >> >> > Set rs = Nothing
> >> >> >> >
> >> >> >> > End Function
> >> >> >> >
> >> >> >> >
> >> >> >> > Here is how I am trying to call it in a query.
> >> >> >> >
> >> >> >> >
> >> >> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours
> >> >> >> > End])
> >> >> >> >
> >> >> >> > Thanks,
> >> >> >> > Dwayne
> >> >> >> >
> >> >> >> >
> >> >> >> > "Barry Gilbert" wrote:
> >> >> >> >
> >> >> >> >> Functions called from queries need to be public functions saved
> >> >> >> >> to
> >> >> >> >> a
> >> >> >> >> module.
> >> >> >> >> Could you post your code and the SQL from your query?
> >> >> >> >>
> >> >> >> >> Barry
> >> >> >> >>
> >> >> >> >> "Dwayne Struble" wrote:
> >> >> >> >>
> >> >> >> >> > I am a new Access user, and am using access 97. I am working
> >> >> >> >> > on
> >> >> >> >> > setting up a
> >> >> >> >> > callout list where the order is determined by overtime hours
> >> >> >> >> > worked.
> >> >> >> >> > I
> >> >> >> >> > set
> >> >> >> >> > upa query that adds the hours at start of pay period with the
> >> >> >> >> > hours
> >> >> >> >> > worked
> >> >> >> >> > and gets total then sorts it. I then need it to show the
> >> >> >> >> > updated
> >> >> >> >> > place
> >> >> >> >> > in
> >> >> >> >> > the order. I found a funtion that does that in another post
> >> >> >> >> > here,
> >> >> >> >> > but
> >> >> >> >> > when I
> >> >> >> >> > put the funtion in a module and called it in the query, I get
> >> >> >> >> > an
> >> >> >> >> > error
> >> >> >> >> > stating undefined funtion. Thanks for your help.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 28.09.2006 12:11:15
You can't use [OT Hours End] in the Immediate window: it has no way of
knowing what that is. You have to pass a value. I think that's the "External
name not defined" error. The "Expected: = " error is because you're trying
to run a function, and not giving it anyway to deal with what's being
returned. If you want to try without wanting the value that's returned, you
need to use the Call keyword:

Call Serialize("OPS Communicators","OT Hours End",xxx)



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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:3E051908-B31B-4A68-BB52-679C192C4EAF[ at ]microsoft.com...
[Quoted Text]
> Doug,
>
> I tried it with and without the question mark. I got compile errors both
> times. With the question mark, I got the message; External name not
> defined.
> Without question mark I got the message; Expected: =
> I used [OT Hours End] as the xxx.
>
> Thanks,
> Dwayne
>
> "Douglas J. Steele" wrote:
>
>> A compile error, or an execution error?
>>
>> Did you include the question mark at the beginning? What did you put for
>> xxx?
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> message
>> news:E29EC40A-BB7B-4F36-87BB-84A7656E7EDF[ at ]microsoft.com...
>> > Doug,
>> >
>> > I get a compile error;
>> > Expected: =
>> >
>> > Thanks,
>> > Dwayne
>> >
>> >
>> > "Douglas J. Steele" wrote:
>> >
>> >> What happens if you go to the Immediate window (Ctrl-G), type
>> >>
>> >> ?Serialize("OPS Communicators","OT Hours End",xxx)
>> >>
>> >> (replacing xxx with a legitimate value) and hit Enter?
>> >>
>> >> --
>> >> Doug Steele, Microsoft Access MVP
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> message
>> >> news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
>> >> > Doug,
>> >> >
>> >> > Sorry, yes I made it a module in the module area. Yes I did verify
>> >> > my
>> >> > spelling was consistant in both areas.
>> >> >
>> >> > Dwayne
>> >> >
>> >> > "Douglas J. Steele" wrote:
>> >> >
>> >> >> You didn't answer one of my earlier questions: are you talking
>> >> >> about a
>> >> >> "true" module (one that you get to through
>> >> >> the Modules tab), as opposed to a module associated with a form or
>> >> >> report?
>> >> >>
>> >> >> I assume you've checked to ensure that you haven't mistyped the
>> >> >> name
>> >> >> of
>> >> >> the
>> >> >> function in your query.
>> >> >>
>> >> >> --
>> >> >> Doug Steele, Microsoft Access MVP
>> >> >> http://I.Am/DougSteele
>> >> >> (no e-mails, please!)
>> >> >>
>> >> >>
>> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
>> >> >> > Doug,
>> >> >> >
>> >> >> > Since I am still setting up the database, I am running it after
>> >> >> > I
>> >> >> > save
>> >> >> > by
>> >> >> > going from design view to datasheet view. Also I get the error
>> >> >> > when
>> >> >> > double
>> >> >> > clicking on it.
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Dwayne
>> >> >> >
>> >> >> > "Douglas J. Steele" wrote:
>> >> >> >
>> >> >> >> How are you calling the query? Is it through code, or are you
>> >> >> >> simply
>> >> >> >> double-clicking on the query to open it? If you're opening it
>> >> >> >> through
>> >> >> >> code,
>> >> >> >> what's that code.
>> >> >> >>
>> >> >> >> --
>> >> >> >> Doug Steele, Microsoft Access MVP
>> >> >> >> http://I.Am/DougSteele
>> >> >> >> (no e-mails, please!)
>> >> >> >>
>> >> >> >>
>> >> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote
>> >> >> >> in
>> >> >> >> message
>> >> >> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
>> >> >> >> > Here is the module I am trying to use.
>> >> >> >> >
>> >> >> >> > Function Serialize(qryname As String, keyname As String,
>> >> >> >> > keyvalue)
>> >> >> >> > As
>> >> >> >> > Long
>> >> >> >> >
>> >> >> >> > Dim rs As Recordset
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Error GoTo Err_Serialize
>> >> >> >> >
>> >> >> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset,
>> >> >> >> > dbReadOnly)
>> >> >> >> >
>> >> >> >> > rs.FindFirst Application.BuildCriteria(keyname,
>> >> >> >> > rs.Fields(keyname).Type,
>> >> >> >> > keyvalue)
>> >> >> >> >
>> >> >> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Err_Serialize:
>> >> >> >> >
>> >> >> >> > rs.Close
>> >> >> >> >
>> >> >> >> > Set rs = Nothing
>> >> >> >> >
>> >> >> >> > End Function
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Here is how I am trying to call it in a query.
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours
>> >> >> >> > End])
>> >> >> >> >
>> >> >> >> > Thanks,
>> >> >> >> > Dwayne
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > "Barry Gilbert" wrote:
>> >> >> >> >
>> >> >> >> >> Functions called from queries need to be public functions
>> >> >> >> >> saved
>> >> >> >> >> to
>> >> >> >> >> a
>> >> >> >> >> module.
>> >> >> >> >> Could you post your code and the SQL from your query?
>> >> >> >> >>
>> >> >> >> >> Barry
>> >> >> >> >>
>> >> >> >> >> "Dwayne Struble" wrote:
>> >> >> >> >>
>> >> >> >> >> > I am a new Access user, and am using access 97. I am
>> >> >> >> >> > working
>> >> >> >> >> > on
>> >> >> >> >> > setting up a
>> >> >> >> >> > callout list where the order is determined by overtime
>> >> >> >> >> > hours
>> >> >> >> >> > worked.
>> >> >> >> >> > I
>> >> >> >> >> > set
>> >> >> >> >> > upa query that adds the hours at start of pay period with
>> >> >> >> >> > the
>> >> >> >> >> > hours
>> >> >> >> >> > worked
>> >> >> >> >> > and gets total then sorts it. I then need it to show the
>> >> >> >> >> > updated
>> >> >> >> >> > place
>> >> >> >> >> > in
>> >> >> >> >> > the order. I found a funtion that does that in another
>> >> >> >> >> > post
>> >> >> >> >> > here,
>> >> >> >> >> > but
>> >> >> >> >> > when I
>> >> >> >> >> > put the funtion in a module and called it in the query, I
>> >> >> >> >> > get
>> >> >> >> >> > an
>> >> >> >> >> > error
>> >> >> >> >> > stating undefined funtion. Thanks for your help.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Re: Module not working
Dwayne Struble 28.09.2006 12:46:02
Doug,

I tried it using 1 or 2 as xxx and also using the call command. I now get
a compile error with this message; Expected variable or Procedure, not
Module. I also tried just using the absoluteposition function in an
expression within query and I get the error, unknown function
absoluteposition, and that is one that is in Access.

Thanks,
Dwayne

"Douglas J. Steele" wrote:

[Quoted Text]
> You can't use [OT Hours End] in the Immediate window: it has no way of
> knowing what that is. You have to pass a value. I think that's the "External
> name not defined" error. The "Expected: = " error is because you're trying
> to run a function, and not giving it anyway to deal with what's being
> returned. If you want to try without wanting the value that's returned, you
> need to use the Call keyword:
>
> Call Serialize("OPS Communicators","OT Hours End",xxx)
>
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
> news:3E051908-B31B-4A68-BB52-679C192C4EAF[ at ]microsoft.com...
> > Doug,
> >
> > I tried it with and without the question mark. I got compile errors both
> > times. With the question mark, I got the message; External name not
> > defined.
> > Without question mark I got the message; Expected: =
> > I used [OT Hours End] as the xxx.
> >
> > Thanks,
> > Dwayne
> >
> > "Douglas J. Steele" wrote:
> >
> >> A compile error, or an execution error?
> >>
> >> Did you include the question mark at the beginning? What did you put for
> >> xxx?
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> message
> >> news:E29EC40A-BB7B-4F36-87BB-84A7656E7EDF[ at ]microsoft.com...
> >> > Doug,
> >> >
> >> > I get a compile error;
> >> > Expected: =
> >> >
> >> > Thanks,
> >> > Dwayne
> >> >
> >> >
> >> > "Douglas J. Steele" wrote:
> >> >
> >> >> What happens if you go to the Immediate window (Ctrl-G), type
> >> >>
> >> >> ?Serialize("OPS Communicators","OT Hours End",xxx)
> >> >>
> >> >> (replacing xxx with a legitimate value) and hit Enter?
> >> >>
> >> >> --
> >> >> Doug Steele, Microsoft Access MVP
> >> >> http://I.Am/DougSteele
> >> >> (no e-mails, please!)
> >> >>
> >> >>
> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
> >> >> > Doug,
> >> >> >
> >> >> > Sorry, yes I made it a module in the module area. Yes I did verify
> >> >> > my
> >> >> > spelling was consistant in both areas.
> >> >> >
> >> >> > Dwayne
> >> >> >
> >> >> > "Douglas J. Steele" wrote:
> >> >> >
> >> >> >> You didn't answer one of my earlier questions: are you talking
> >> >> >> about a
> >> >> >> "true" module (one that you get to through
> >> >> >> the Modules tab), as opposed to a module associated with a form or
> >> >> >> report?
> >> >> >>
> >> >> >> I assume you've checked to ensure that you haven't mistyped the
> >> >> >> name
> >> >> >> of
> >> >> >> the
> >> >> >> function in your query.
> >> >> >>
> >> >> >> --
> >> >> >> Doug Steele, Microsoft Access MVP
> >> >> >> http://I.Am/DougSteele
> >> >> >> (no e-mails, please!)
> >> >> >>
> >> >> >>
> >> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
> >> >> >> message
> >> >> >> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
> >> >> >> > Doug,
> >> >> >> >
> >> >> >> > Since I am still setting up the database, I am running it after
> >> >> >> > I
> >> >> >> > save
> >> >> >> > by
> >> >> >> > going from design view to datasheet view. Also I get the error
> >> >> >> > when
> >> >> >> > double
> >> >> >> > clicking on it.
> >> >> >> >
> >> >> >> > Thanks,
> >> >> >> > Dwayne
> >> >> >> >
> >> >> >> > "Douglas J. Steele" wrote:
> >> >> >> >
> >> >> >> >> How are you calling the query? Is it through code, or are you
> >> >> >> >> simply
> >> >> >> >> double-clicking on the query to open it? If you're opening it
> >> >> >> >> through
> >> >> >> >> code,
> >> >> >> >> what's that code.
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> Doug Steele, Microsoft Access MVP
> >> >> >> >> http://I.Am/DougSteele
> >> >> >> >> (no e-mails, please!)
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote
> >> >> >> >> in
> >> >> >> >> message
> >> >> >> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
> >> >> >> >> > Here is the module I am trying to use.
> >> >> >> >> >
> >> >> >> >> > Function Serialize(qryname As String, keyname As String,
> >> >> >> >> > keyvalue)
> >> >> >> >> > As
> >> >> >> >> > Long
> >> >> >> >> >
> >> >> >> >> > Dim rs As Recordset
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > On Error GoTo Err_Serialize
> >> >> >> >> >
> >> >> >> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset,
> >> >> >> >> > dbReadOnly)
> >> >> >> >> >
> >> >> >> >> > rs.FindFirst Application.BuildCriteria(keyname,
> >> >> >> >> > rs.Fields(keyname).Type,
> >> >> >> >> > keyvalue)
> >> >> >> >> >
> >> >> >> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Err_Serialize:
> >> >> >> >> >
> >> >> >> >> > rs.Close
> >> >> >> >> >
> >> >> >> >> > Set rs = Nothing
> >> >> >> >> >
> >> >> >> >> > End Function
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Here is how I am trying to call it in a query.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT Hours
> >> >> >> >> > End])
> >> >> >> >> >
> >> >> >> >> > Thanks,
> >> >> >> >> > Dwayne
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > "Barry Gilbert" wrote:
> >> >> >> >> >
> >> >> >> >> >> Functions called from queries need to be public functions
> >> >> >> >> >> saved
> >> >> >> >> >> to
> >> >> >> >> >> a
> >> >> >> >> >> module.
> >> >> >> >> >> Could you post your code and the SQL from your query?
> >> >> >> >> >>
> >> >> >> >> >> Barry
> >> >> >> >> >>
> >> >> >> >> >> "Dwayne Struble" wrote:
> >> >> >> >> >>
> >> >> >> >> >> > I am a new Access user, and am using access 97. I am
> >> >> >> >> >> > working
> >> >> >> >> >> > on
> >> >> >> >> >> > setting up a
> >> >> >> >> >> > callout list where the order is determined by overtime
> >> >> >> >> >> > hours
> >> >> >> >> >> > worked.
> >> >> >> >> >> > I
> >> >> >> >> >> > set
> >> >> >> >> >> > upa query that adds the hours at start of pay period with
> >> >> >> >> >> > the
> >> >> >> >> >> > hours
> >> >> >> >> >> > worked
> >> >> >> >> >> > and gets total then sorts it. I then need it to show the
> >> >> >> >> >> > updated
> >> >> >> >> >> > place
> >> >> >> >> >> > in
> >> >> >> >> >> > the order. I found a funtion that does that in another
> >> >> >> >> >> > post
> >> >> >> >> >> > here,
> >> >> >> >> >> > but
> >> >> >> >> >> > when I
> >> >> >> >> >> > put the funtion in a module and called it in the query, I
> >> >> >> >> >> > get
> >> >> >> >> >> > an
> >> >> >> >> >> > error
> >> >> >> >> >> > stating undefined funtion. Thanks for your help.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Module not working
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 28.09.2006 13:03:31
Sorry, I'm running out of ideas. As a test, I just copied the function you
posted into an existing Access 97 database, and had no problem using it in a
query.

Try putting a breakpoint into the function (you do this by clicking in the
border to the left of a line of code in the editor. This should put a circle
in the border, and highlight the entire row). Then, try executing the same
command in the immediate window. You should be taken into the function.
Single-step through the code, using the F8 key. What line of code is raising
the error?

I don't understand what you mean by "using the absoluteposition function in
an expression within query". The AbsolutePosition property only applies to
recordsets: you can't put it into a query.

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


"Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in message
news:1A2E5BCA-DBB0-43FB-B7E6-3D34F11CDC6D[ at ]microsoft.com...
[Quoted Text]
> Doug,
>
> I tried it using 1 or 2 as xxx and also using the call command. I now
> get
> a compile error with this message; Expected variable or Procedure, not
> Module. I also tried just using the absoluteposition function in an
> expression within query and I get the error, unknown function
> absoluteposition, and that is one that is in Access.
>
> Thanks,
> Dwayne
>
> "Douglas J. Steele" wrote:
>
>> You can't use [OT Hours End] in the Immediate window: it has no way of
>> knowing what that is. You have to pass a value. I think that's the
>> "External
>> name not defined" error. The "Expected: = " error is because you're
>> trying
>> to run a function, and not giving it anyway to deal with what's being
>> returned. If you want to try without wanting the value that's returned,
>> you
>> need to use the Call keyword:
>>
>> Call Serialize("OPS Communicators","OT Hours End",xxx)
>>
>>
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> message
>> news:3E051908-B31B-4A68-BB52-679C192C4EAF[ at ]microsoft.com...
>> > Doug,
>> >
>> > I tried it with and without the question mark. I got compile errors
>> > both
>> > times. With the question mark, I got the message; External name not
>> > defined.
>> > Without question mark I got the message; Expected: =
>> > I used [OT Hours End] as the xxx.
>> >
>> > Thanks,
>> > Dwayne
>> >
>> > "Douglas J. Steele" wrote:
>> >
>> >> A compile error, or an execution error?
>> >>
>> >> Did you include the question mark at the beginning? What did you put
>> >> for
>> >> xxx?
>> >>
>> >> --
>> >> Doug Steele, Microsoft Access MVP
>> >> http://I.Am/DougSteele
>> >> (no e-mails, please!)
>> >>
>> >>
>> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> message
>> >> news:E29EC40A-BB7B-4F36-87BB-84A7656E7EDF[ at ]microsoft.com...
>> >> > Doug,
>> >> >
>> >> > I get a compile error;
>> >> > Expected: =
>> >> >
>> >> > Thanks,
>> >> > Dwayne
>> >> >
>> >> >
>> >> > "Douglas J. Steele" wrote:
>> >> >
>> >> >> What happens if you go to the Immediate window (Ctrl-G), type
>> >> >>
>> >> >> ?Serialize("OPS Communicators","OT Hours End",xxx)
>> >> >>
>> >> >> (replacing xxx with a legitimate value) and hit Enter?
>> >> >>
>> >> >> --
>> >> >> Doug Steele, Microsoft Access MVP
>> >> >> http://I.Am/DougSteele
>> >> >> (no e-mails, please!)
>> >> >>
>> >> >>
>> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:F66950E6-74BE-4FA1-B0D9-B2E7CB13B97C[ at ]microsoft.com...
>> >> >> > Doug,
>> >> >> >
>> >> >> > Sorry, yes I made it a module in the module area. Yes I did
>> >> >> > verify
>> >> >> > my
>> >> >> > spelling was consistant in both areas.
>> >> >> >
>> >> >> > Dwayne
>> >> >> >
>> >> >> > "Douglas J. Steele" wrote:
>> >> >> >
>> >> >> >> You didn't answer one of my earlier questions: are you talking
>> >> >> >> about a
>> >> >> >> "true" module (one that you get to through
>> >> >> >> the Modules tab), as opposed to a module associated with a form
>> >> >> >> or
>> >> >> >> report?
>> >> >> >>
>> >> >> >> I assume you've checked to ensure that you haven't mistyped the
>> >> >> >> name
>> >> >> >> of
>> >> >> >> the
>> >> >> >> function in your query.
>> >> >> >>
>> >> >> >> --
>> >> >> >> Doug Steele, Microsoft Access MVP
>> >> >> >> http://I.Am/DougSteele
>> >> >> >> (no e-mails, please!)
>> >> >> >>
>> >> >> >>
>> >> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com> wrote
>> >> >> >> in
>> >> >> >> message
>> >> >> >> news:69BDC30D-5565-4CAD-822F-AED72EAC3CEC[ at ]microsoft.com...
>> >> >> >> > Doug,
>> >> >> >> >
>> >> >> >> > Since I am still setting up the database, I am running it
>> >> >> >> > after
>> >> >> >> > I
>> >> >> >> > save
>> >> >> >> > by
>> >> >> >> > going from design view to datasheet view. Also I get the
>> >> >> >> > error
>> >> >> >> > when
>> >> >> >> > double
>> >> >> >> > clicking on it.
>> >> >> >> >
>> >> >> >> > Thanks,
>> >> >> >> > Dwayne
>> >> >> >> >
>> >> >> >> > "Douglas J. Steele" wrote:
>> >> >> >> >
>> >> >> >> >> How are you calling the query? Is it through code, or are you
>> >> >> >> >> simply
>> >> >> >> >> double-clicking on the query to open it? If you're opening it
>> >> >> >> >> through
>> >> >> >> >> code,
>> >> >> >> >> what's that code.
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> Doug Steele, Microsoft Access MVP
>> >> >> >> >> http://I.Am/DougSteele
>> >> >> >> >> (no e-mails, please!)
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> "Dwayne Struble" <DwayneStruble[ at ]discussions.microsoft.com>
>> >> >> >> >> wrote
>> >> >> >> >> in
>> >> >> >> >> message
>> >> >> >> >> news:30B4A49D-A2DA-4A13-ABE4-FE42D9427031[ at ]microsoft.com...
>> >> >> >> >> > Here is the module I am trying to use.
>> >> >> >> >> >
>> >> >> >> >> > Function Serialize(qryname As String, keyname As String,
>> >> >> >> >> > keyvalue)
>> >> >> >> >> > As
>> >> >> >> >> > Long
>> >> >> >> >> >
>> >> >> >> >> > Dim rs As Recordset
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > On Error GoTo Err_Serialize
>> >> >> >> >> >
>> >> >> >> >> > Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset,
>> >> >> >> >> > dbReadOnly)
>> >> >> >> >> >
>> >> >> >> >> > rs.FindFirst Application.BuildCriteria(keyname,
>> >> >> >> >> > rs.Fields(keyname).Type,
>> >> >> >> >> > keyvalue)
>> >> >> >> >> >
>> >> >> >> >> > Serialize = Nz(rs.AbsolutePosition, -1) + 1
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > Err_Serialize:
>> >> >> >> >> >
>> >> >> >> >> > rs.Close
>> >> >> >> >> >
>> >> >> >> >> > Set rs = Nothing
>> >> >> >> >> >
>> >> >> >> >> > End Function
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > Here is how I am trying to call it in a query.
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > Expr1: Serialize("OPS Communicators","OT Hours End",[OT
>> >> >> >> >> > Hours
>> >> >> >> >> > End])
>> >> >> >> >> >
>> >> >> >> >> > Thanks,
>> >> >> >> >> > Dwayne
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > "Barry Gilbert" wrote:
>> >> >> >> >> >
>> >> >> >> >> >> Functions called from queries need to be public functions
>> >> >> >> >> >> saved
>> >> >> >> >> >> to
>> >> >> >> >> >> a
>> >> >> >> >> >> module.
>> >> >> >> >> >> Could you post your code and the SQL from your query?
>> >> >> >> >> >>
>> >> >> >> >> >> Barry
>> >> >> >> >> >>
>> >> >> >> >> >> "Dwayne Struble" wrote:
>> >> >> >> >> >>
>> >> >> >> >> >> > I am a new Access user, and am using access 97. I am
>> >> >> >> >> >> > working
>> >> >> >> >> >> > on
>> >> >> >> >> >> > setting up a
>> >> >> >> >> >> > callout list where the order is determined by overtime
>> >> >> >> >> >> > hours
>> >> >> >> >> >> > worked.
>> >> >> >> >> >> > I
>> >> >> >> >> >> > set
>> >> >> >> >> >> > upa query that adds the hours at start of pay period
>> >> >> >> >> >> > with
>> >> >> >> >> >> > the
>> >> >> >> >> >> > hours
>> >> >> >> >> >> > worked
>> >> >> >> >> >> > and gets total then sorts it. I then need it to show
>> >> >> >> >> >> > the
>> >> >> >> >> >> > updated
>> >> >> >> >> >> > place
>> >> >> >> >> >> > in
>> >> >> >> >> >> > the order. I found a funtion that does that in another
>> >> >> >> >> >> > post
>> >> >> >> >> >> > here,
>> >> >> >> >> >> > but
>> >> >> >> >> >> > when I
>> >> >> >> >> >> > put the funtion in a module and called it in the query,
>> >> >> >> >> >> > I
>> >> >> >> >> >> > get
>> >> >> >> >> >> > an
>> >> >> >> >> >> > error
>> >> >> >> >> >> > stating undefined funtion. Thanks for your help.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net