How to add my own functions to access 2007: to select in "build"

B

Beepa

Here is the deal. I would like to create my own vb function to use in the
experession builder in Access 2007. Is that possible? One I want to create is
to determine a week number. I know I can do this in the table but I am
working in a quiery.

Or maybe you can tell me how to enter criteria so that I can pull up records
for the previous week. I want to enter a salesID which will pull up sales in
the current week in one column and the previous week in another column. The
weeks are numerical values. week 1,2 etc. I have a field set up in my talbe
that has the week number but I'm having some sort of brain fart when in my
query I try to set the criteria for the week number as the current week
number -1. I tired referencing the table field and the query field by name
then -1 ie: [weeknum] -1 but this didn't succeed.
Once again thank you for your assistance,
 
S

S.Clark

To create a VBA Function, Press Alt-F11 to open the VBA development
environment. Create a new module, and add your function.

Other than that, you're not completely clear in your needs, but feel free to
provide more information. Especially table structure info.
 
B

Beepa

Ty for you help. I was trying to create a function in a query that wasn't
listed. I didn't see a date function that produced a week number.

S.Clark said:
To create a VBA Function, Press Alt-F11 to open the VBA development
environment. Create a new module, and add your function.

Other than that, you're not completely clear in your needs, but feel free to
provide more information. Especially table structure info.

--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



Beepa said:
Here is the deal. I would like to create my own vb function to use in the
experession builder in Access 2007. Is that possible? One I want to create is
to determine a week number. I know I can do this in the table but I am
working in a quiery.

Or maybe you can tell me how to enter criteria so that I can pull up records
for the previous week. I want to enter a salesID which will pull up sales in
the current week in one column and the previous week in another column. The
weeks are numerical values. week 1,2 etc. I have a field set up in my talbe
that has the week number but I'm having some sort of brain fart when in my
query I try to set the criteria for the week number as the current week
number -1. I tired referencing the table field and the query field by name
then -1 ie: [weeknum] -1 but this didn't succeed.
Once again thank you for your assistance,
 
S

S.Clark

SELECT OrderDate, Format([OrderDate],"ww") AS TheWeek
FROM [Purchase Orders];

--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



Beepa said:
Ty for you help. I was trying to create a function in a query that wasn't
listed. I didn't see a date function that produced a week number.

S.Clark said:
To create a VBA Function, Press Alt-F11 to open the VBA development
environment. Create a new module, and add your function.

Other than that, you're not completely clear in your needs, but feel free to
provide more information. Especially table structure info.

--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



Beepa said:
Here is the deal. I would like to create my own vb function to use in the
experession builder in Access 2007. Is that possible? One I want to create is
to determine a week number. I know I can do this in the table but I am
working in a quiery.

Or maybe you can tell me how to enter criteria so that I can pull up records
for the previous week. I want to enter a salesID which will pull up sales in
the current week in one column and the previous week in another column. The
weeks are numerical values. week 1,2 etc. I have a field set up in my talbe
that has the week number but I'm having some sort of brain fart when in my
query I try to set the criteria for the week number as the current week
number -1. I tired referencing the table field and the query field by name
then -1 ie: [weeknum] -1 but this didn't succeed.
Once again thank you for your assistance,
 
Top