General :: User Defined Function Exports Julian Date
Jan 10, 2013
I have created user defined function for lastdayofweek, lastdayofmonth, and firstdayofmonth. When I apply this function to an expression in my query, it returns a julian date. How do I apply the format for the calendar date?
Maybe I am not calling my function correctly. Here's my functions below as well as my expression..
Function LastDayThisMonth()
LastDayThisMonth = DateSerial(Year(Date), Month(Date) + 1, 0)
End Function
Function FirstDayThisMonth()
FirstDayThisMonth = DateSerial(Year(Date), Month(Date), 1)
End Function
[Code] ....
View Replies
ADVERTISEMENT
Jul 22, 2014
I have written a user defined function that calculates the end of the current month. This I named EndOfThisMonth. It works well as a function. Now I would like to use it as date criteria to include in a query. The function is included as such EndOfThisMonth().
The field on which this function is to enter as a criteria is another calculated date function called Due.
When I run this query I get an error message saying Undefined Function 'EndOfThisMonth' in expression.
View 3 Replies
View Related
Feb 10, 2014
I have a line of code in an old program:
Dim CN as ADODB Connection
This is giving me the error 'User defined type not defined'. I know I have to set something in a list somewhere but have forgotten how to do that. Where to go, and what to set?
View 1 Replies
View Related
Oct 29, 2007
Hi All
I have used Allen Browne's code (see http://allenbrowne.com/ser-16.html, bottom of page) as a model for my user-defined type and public function in an events management database.
Using the function in forms/VBA works fine.
But my DB crashes whenever I try to use it in a query.
My modules code:
= = =
Option Compare Database
Public Type EvCheks
EvType As String
EvAttCat As String
EvUnitAss As String
EvCheksAll As String
End Type
= =
Public Function getEvCheks(EV, EvUnit) as EvCheks
'Event Type: Event or DL
If (DLookup("evtype", "tblevents", "[evid] = " & EV)) = "Event" Then
getEvCheks.EvType = "Y"
Else: getEvCheks.EvType = "N"
End If
'Event Attendance Category: INDB= in database or LIST
If (DLookup("evattcat", "tblevents", "[evid] = " & EV)) = "INDB" Then
getEvCheks.EvAttCat = "Y"
Else: getEvCheks.EvAttCat = "N"
End If
'Event Assessing Organisation
Dim AOROName As String
Dim AOName As String
AOROName = DLookup("evunitassessable", "tblevunits", "[evunitid] = " & EvUnit)
AOName = Mid([AOROName], 1, InStr([AOROName], "/") - 1)
Select Case AOName
Case "NA"
getEvCheks.EvUnitAss = "N"
Case "ABCD"
getEvCheks.EvUnitAss = "Y"
Case Else
getEvCheks.EvUnitAss = "X"
End Select
getEvCheks.EvCheksAll = getEvCheks.EvType & getEvCheks.EvAttCat & getEvCheks.EvUnitAss
End Function
====
On a form, I have a button with on-click event code that defines the EV and EVU variables and displays a message box
MsgBox getEvCheks(EV, EVU).EvCheksAll
This works fine.
=====
In a query I have this SQL code:
SELECT tblEvUnits.EvId, tblEvUnits.EvUnitID, getevcheks([evid],[evunitid]) AS EventDetails
FROM tblEvUnits;
This causes the db to crash.
I cannot get the "back-end" definition of the function into the query, as Access rejects it because of the dot, i.e. ".EvCheksAll".
I suspect there is some formatting quirk for using a public function that includes a user-defined type, in a query.
Any/all assistance much appreciated.
Regards
AlanM
View 3 Replies
View Related
Jul 15, 2013
I have quite a few user defined / custom functions which I would like to be available in any new database that I create without have to copy the VBA codes in a module each time. Basically, some sort of add-in that loads on MS Access startup may be (but I am not too sure - never created one). So something that will start with the MS Access Application and not just a particular database. I know excel addins can be copied to the XLStartup folder to achieve something like this in excel, but not sure about Access.
View 11 Replies
View Related
Apr 16, 2008
I want to run an activity query (i.e. objective is to check which data lines have changed) within a user defined date range. Please advise what is the most efficient way to achieve this.
Is it possible to run such a report without having a date column i.e. does Access have a hidden line modification date that can be used in a search?
Look forward to your feedback - thanks!
View 2 Replies
View Related
Apr 17, 2008
Hello all, im new here so hi to everyone.
Im stuck! I am pretty much a novice when it comes to access and have been given the task or creating some reports to stop us doing it manually.
Within a query, I have a date column which we would currently enter the following into the criteria:
Between #01/01/2008# And #31/01/2008#
for the month of January.
What i want to be able to do (and i know is possible as ive done it in the past but cant remember how) is have a pop up when the query is ran to enter the Start date and End date. I remember it being something to do with square brackets but cant get it to work.
Help please! lol
View 14 Replies
View Related
Sep 16, 2012
I have a database that creates many forms based on queries which are based on user-defined variables. These are permanent variables added directly in the query, such as "if an employee is late 4 times in a month, we yell at them." I would like to be able to change this to "5 times in a month" if the users want to.
Rather than waiting for that to happen and having to change all my queries, i want to set up a form for them to access and edit the variable, save it, and then my queries to reference that variable.
My question is what is the best way to store and reference them? I could create a table, but i am not too sure how easy it would be to make my queries work with that.
I could also add them onto my main form which is always open, but I'm not sure how to make them save when access is closed. (a quick trial from my variable form won't let me update either a text box or label value on the main form).
View 5 Replies
View Related
Apr 20, 2015
I copied some VBA from one database to another. I didn't change anything and I am able to run it fine in the first database. But in the DB I pasted it to, I am received a Compile Error message with the XlApp As Excel.Application area highlighted.
Function OpenAutoCount()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
[code]...
View 3 Replies
View Related
Feb 18, 2014
I want to set my paper size to user defined, but it not working,
<<<<<<<<<<<<<<<<<<<<<<<<<<
Set Application.Printer = Application.Printers("P1121E")
Application.Printer.PaperSize = acPRPSUser
Application.Printer.ItemSizeHeight = 9.35 Application.Printer.ItemSizeWidth = 26.9
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Showing "Run time error "2595"
"Cannot set this property when defaultsize property is set to true"
I try add "Application.Printer.Defaultsize = true or false" also not working
View 1 Replies
View Related
Nov 9, 2005
Hi,
On Compiling my assecc database VB code I get the following error message "User defined type not defined". I understand it is beecause I have not declared the Variable Type, but have no idea to exactly which part of the code the error is referring to.
How do I find out WHICH User defined type is not defined, especially when I have not got any (or do not want to use any) user defined types?
Thank you in advanced programming wizards. Kind regards, Adam.
View 14 Replies
View Related
Oct 15, 2004
Dim XL As Excel.Application
When I try to run this specific line of code an error occurs. It says:
"User-defined type not defined"
May I know how to solve this problem?
Thanks a lot
View 1 Replies
View Related
Sep 27, 2005
I've put in this in a module many times and this is the first time I have gotten an error.
Dim Conn As ADODB.Connection
When I run the app I am getting a compile error saying "User-defined type not defined".
Anyone have any ideas?
Thanks,
B
View 3 Replies
View Related
Dec 22, 2005
This may be simple but I'm having a real issue with it. I've used
Format([Input Table]!Birth_Date,"yyyy") & Format(Format([Input Table]!Birth_Date,"y"),"000")
to go from a date to a julian but now I need to go from a 4 digit julian date to a mm/dd/yyyy.
For example ... Today is julian date 5356 "year 2005 and 356 days into the year" and I need to change this back to 12/22/2005.
How do you do this :confused: I would rather do it within the query than do any code.
View 4 Replies
View Related
Sep 4, 2006
I recently upgraded from MS Access 2000 to 2003 I now appear to have a problem with my julian date conversion formulae. Everything was working fine but since 01Sept none of my date/time specific queries work. Please can someone advise me of a Julian Day to Calendar date formula for MS Acces 2003. In my date field I have the following :
Date: DateSerial(6,1,[CR10X AWS]!Field2)
Note sure about the 'DateSerial(6,1, part ?
Regards
Richard
View 1 Replies
View Related
Dec 8, 2005
I am extracting information from a datawarehouse with a make table query. I will run this queary one time to create the table. Then I plan on creating an append queary to extract the same fields on a weekly basis. I want to keep track of the datasets that i extract weekly. I thought I could create a field with a julian date or the week of the year. Does anyone know how I could create this field in my append queary? OR any thoughts on how i can keep track of the records appended each week?
View 3 Replies
View Related
Jun 21, 2014
I'm using Access 2010's DoCmd.OutputTo in VBA to export reports to PDF. The "look and feel" of the PDFs are very important, as they will be distributed to clients of my company. I'm using special corporate fonts that are legally licensed for embedding as a subset. Two are .ttf (TrueType) and two are .otf (OpenType) fonts. The ttf fonts embed fine; the otf fonts do not, and the PDF viewer substitutes something it thinks is close (but really isn't). In the properties of the fonts in Windows Control Panel, the embedding properties are exactly the same for both.
Any way to force the fonts to embed? or any other workaround? Also, is there any way to edit-protect PDFs with VBA code? Or apply any other type of PDF security such as requiring a password to open?
View 3 Replies
View Related
Jun 13, 2007
Let's see if I can explain this situation effectively...
I've been handed a database that is set up to track tutoring sessions of students. The original creator designed the database for 1 semester. I am trying to make it functional for x number of semesters. So here's my dilemma: I have several reports that are based on queries. I would like for the user to be able to run the report and it prompt for them to enter a date range, which would then output desired results for that range (I thought this would be more efficient than setting up the db to run reports by semester, so that the user would be able to narrow their results).
So in corresponding queries, I am adding the following criteria to the "Date" field:
Between [Enter Beginning Date] And [Enter Ending Date]. The query produces the right results, just not exactly in the way I would like to see them. This is because the query tracks the number of hours per mentor (the person giving the tutoring) and does a sum.
So in my results, it is summing the hours for every change in date occurrence. For example, the results should look like this (on the report):
Student 1
Mentor A xtotal hours
Student 2
Mentor A xtotal hours
Mentor B xtotal hours
Instead what I'm getting is a sum of hours for every different date, as follows:
Student 1
Mentor A xtotal hours
Mentor A xtotal hours
Mentor A xtotal hours
Student 2
Mentor A xtotal hours
Mentor A xtotal hours
Mentor B xtotal hours
Mentor B xtotal hours
Mentor B xtotal hours
Mentor B xtotal hours
And so on...
Maybe I'm approaching this is the wrong fashion? I haven't had much luck searching google or access help... maybe I'm searching with the wrong strings. :)
Any advice would be greatly appreciated.
View 6 Replies
View Related
May 18, 2015
We have small data dumps from a webservice delivered to us daily in csv format. I'd like to create a system where we can have the data automatically imported into either Access.
My idea is this:
1. CSV is downloaded to <x> folder.
2. Scheduled Task runs script to look in folder <x>
3. If CSV is found in folder <x>, import it's data into a fixed Access db->table.
4. Move CSV to an archive folder to avoid re-processing.
Is this feasible? How complicated would it be, and how to get it on track?
View 1 Replies
View Related
Aug 22, 2013
I'm merging a few databases together. They're fairly simple on their own but I'd like them as one big database. I read that I should import each access database into a new, blank one.
It all works fine, but none of the saved imports and exports come with them. Unfortunately, these imports and exports are relied upon quite heavily.
Is there a way to bring saved imports over from other databases, or will I have to rebuild each one?
View 3 Replies
View Related
May 12, 2014
when run it gives error sub or function not defined. Adopted from nothwind databse.
Private Sub ServiceID_AfterUpdate()
'Initialize price and discount for each product change
If Not IsNull(Me![ServiceID]) Then
[Code]....
View 4 Replies
View Related
Jun 16, 2005
Has anyone ever produced a function to let users, pick their own tab order for a form.
I am thinking along the lines of holding a tab order for each user for each form.
So when a form opens - if a user has saved a tab order the form will adopt it, if the user has never saved a tab order, the sytem default will be applied.
Would this work.
Paul
View 4 Replies
View Related
Oct 31, 2005
Can anyone help?
Is it possible to have an autonumber that is generated depending on the entry in a particular field? I'm creating a database to track various enquiries and I would like each enquiry to have a unique number that is preceded by a codenumber that identifies its origin. For example:
ABC query - 100xxx
DEF query - 200xxx
XYZ query - 300xxx
(xxx denotes the autonumber part)
This way a particular query can be identified just from its number without having to interrogate the main record.
Can it be done? I've searched other posts and not found quite what I'm looking for.
(If not then no probs - I'll think of another way!)
Thanks in advance
View 2 Replies
View Related
Sep 2, 2004
I have a combo box that the user can select a value and the form will display that record on the form. This all works fine, but if the user dosn't enter anything in the combo box, it does not work. Is there a way to have it work if the combo box is left empty?
Thanks in advance - John
View 1 Replies
View Related
Nov 2, 2004
I am trying to get the list of all user defined tables from the Access database.
If I use the following query in Access it's working fine and getting the result. But if I am trying to execute the query in ASP page, it's not working. I am getting an error ([Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'MSysObjects'.)
Can u please tell me the reason.
SELECT MSysObjects.Name AS TableName
FROM MSysObjects
WHERE (((MSysObjects.Type)=1)
AND ((MSysObjects.Flags)=0));
Note: If you have anything, to extract user defined tables, please tell me. Either one works out for me.
View 3 Replies
View Related
Oct 3, 2006
HI,
I have a query [CustomerOrdersByDate] that requests user input for [CustomerID], a 'Start Date' and an 'End Date' for the [OrderDate] field.
the Report works fine, however I'd like it to be able to take the Start & End dates the user has inputted when running the report, and make it appear in the Report header
e.g. Orders Received from [CustomerID], Between {user defined}[Enter Start Date] And {user defined}[Enter End Date].
I have added a text box to display the results and played around with a few different expressions, etc... unsuccessfully so far, and as I'm not up to working with VBA code, I would appreciate some help!
View 2 Replies
View Related