Working With Time Variables

Feb 21, 2008

I need to have my form give he user a Start time and then an End Time.

How do I store the variables (stirng, integer?)

How do I subtract the End Time from the Start Time to get a total time??

I then need to Multiple the resulting time frame by a Rate to calculate total value...

Any thoughts?

THanks

View Replies


ADVERTISEMENT

Counting Date And Time With Variables

Feb 20, 2007

I am currently running a query which shows a date and time for several products:

Product 1 Product 2 Product 3 Product 4
01/01/07 12:00 01/01/07 15:25 01/01/07 15:25 01/01/07 17:36


From this information I need to count each Product unless the date & time is equal or within 30 minutes.

Any help on this one would be greatly appreciated.

View 2 Replies View Related

Modules & VBA :: Initializing Date And Time Variables

Jul 1, 2014

I am writing a process for a hospital application in the UK

We have a concept of "Takes" which are periods to which patients coming into hospital are assigned to and thus the consultant (specialist) who looks after them.

They are fixed times between 0800-2000 (Day take) and 2000-0800 (+1) Night take.

I have written the following function to try and determine which take a patient should be assigned to based on the time now to power various queries to enable the end user to quickly see "today's day take" and "yesterday's take"

Testing it I seem to not be able to hit the right "Take times" in my output. I suspect it's a problem with the way I'm initiating my variables as Today 0800 and Today 2000

Code:
Function GetTakeStarttime()
Dim StartTime As Long
Dim EndTime As Long
Dim CurrentTime As Long
Dim YestStartTime As Long

[Code] .....

View 2 Replies View Related

Working With Time Fields

Mar 15, 2006

Can you calculated time in a query?
Such as hours during any given day?

View 2 Replies View Related

Calculate Time Between Two Working Dates?

Oct 6, 2013

The below function returns correct time difference between workdays. However, it is excluding Saturday as per the code.

It is calculating 06:30 am to 22:00 pm time for weekdays but I also want it to calculate the time from 10:00 to 13:30 on a Saturday.

I am trying to use the NetworkMinutes function to achieve this. However, there is a problem getting the time for Saturday.

Code:
Option Compare Database
Option Explicit
'---------------------------------------------------------------------------------------
' Procedure : NetWorkMinutes
' Author : Rod
' Date : 13/12/2012
' Purpose : Returns the number of work minutes between two date-time arguments.

[code]...

View 14 Replies View Related

Calculate Working Time Between Dates In Access

Oct 26, 2006

I have searched the forum for this answer but no luck. :(

I'm trying to calculate the amount of WORKING time between two dates in an Access database. At the moment i am just subtracting one date from another but this gives me all of the time in between including weekends and evenings.

I need this time to be calculated in hours.

In Excel i know there is a NETWORKINGDAYS function which does something similar but with days rather than hours.

At least if i could get the working days i could then convert it into hours.

Please help!

View 7 Replies View Related

Working Out Total Time Spent (In A Query)

Apr 8, 2008

In My Db I have TblSupportTickets and a Table which records support ticket activity. When adding a new activity detail to the Db it automatically records when the FrmActivityDetail opens and on closing, it records the time the Form was closed. So in TblSupportTickets which relates by ID to TblSupportTicketActivity on a one-to-many relationship.

I then created a query with SupportTicketID, TimeOpen, Time Closed. SupportTicketID criteria is Forms.FrmSupportTicket.txtSupportTicketID

This lists all the time open's and timeclosed's for that support ticket.

how can I work out the total time spent on that support ticket?

View 5 Replies View Related

Short Time Not Working In Make Table Query

Mar 8, 2006

I've set up a query to calculate the difference between 2 time fields. I set the property to short time.

The thing is - when I run the query in a Select query, the times in the column which contains the difference, appear correctly : ie hh:mm, but when I run the same query in as a make table query, the time difference field (although I have set the property to short time) appear something like this:

0.664464564646

Can somebody please tell me how to make it that the time difference results field in my make table query appears as hh:mm??

Thanks in advance - nelld

View 1 Replies View Related

Modules & VBA :: Filter Properties Not Working First Time On Subform

Jan 13, 2015

I have a form that uses a listbox. I can select multiple items and then update a subform. When I press a button with VBA and use the filter property on the subform for the first time, nothing happens. When I press the button a second time, it does - and it works thereafter with different selections. It only happens that first time, after loading the form and pressing the button for the first time.

I have tested that the list items are accessible via the vba variables and stepping through my code and the problem starts with the filter properties.

the statement:

Me.sbfrmCluster.Form.FilterOn = True
Me.sbfrmCluster.Form.Filter = strFilter

is not switched on first time (I have tried a requery and refresh statement after this). When I step through the code the first time, the FilterOn property remains false. A second button press and it is fine.

View 2 Replies View Related

Time Keeping DB - Best Field Format For Working Out Hours Worked

Jun 18, 2006

Hi, I am creating a time keeping db.

Before I jump in and start creating a way to record times worked I thought it best to ask for advice.

The db is created and the last part is to capture by member:
Basically I have the following fields:

MemberID
Job Type
Date of Job
Time Started
Time Finished

From the data captured I need to create a report to show month and ytd hours worked.

It would be easy to ask the user to calculate the hours worked and input the number of hours, however I would like to capture start and finish times.

Can anyone give me any pointers on the best field types and field formats for capturing times which would then make it easier to work out hours worked.

Thanks in advance

Darrell.....

View 1 Replies View Related

Time Format - Short Time Displayed As Medium Time

May 23, 2006

I have an application with a backend db on PC 1, and the same application on PC 2 linked to the backend db on PC 1 via the network.

The link works fine but the time formats are different.

On PC 1 the time format is shortime and displays as it should i.e. in 24 hour clock format

However on PC 2, opening the same database via the network, the time format is still shorttime but when you read the time within the code it comes out in AM/PM format. Also, when the defaul tiem should be #20:00:00# but this changes to #8:00:00 PM#

Weirdly though, when you just open the table, the times are in the correct shorttime format.

Guessing, it must be a setting within the main core of Access 2003 that is different between the 2 instances?

Any ideas?

This screen shot may help:

View 2 Replies View Related

Time Format - Short Time Displayed As Medium Time

May 23, 2006

I have an application with a backend db on PC 1, and the same application on PC 2 linked to the backend db on PC 1 via the network.

The link works fine but the time formats are different.

On PC 1 the time format is shortime and displays as it should i.e. in 24 hour clock format

However on PC 2, opening the same database via the network, the time format is still short time but the format is in AM/PM or medium time.

Guessing, it must be a setting within the main core of Access 2003 that is different between the 2 instances?

Any ideas?

View 1 Replies View Related

How To Use IIf With Three Variables

Aug 15, 2006

Hi, here is a query which returns rolling sum for past5days.The resulting table has threee columns,namely,

MyDateFiled ,MyValue,Past5DaySum


SELECT tblData.MyDateField, tblData.MyValue,
(SELECT SUM(a.MyValue)
FROM tblData As a
WHERE DateDiff("d",a.MyDateField,tblData.MyDateField)
Between 0 and 4)
AS Past5DaySum
FROM tblData;

Someone help me in modifying the above query ,so that ,a Type(1,2,3) can be assigned to each Past5DaySum
based on the following criteria.Is,it possible to use IIF function for three variables ?,so as tp get a new table(Mydate,MyValue,PastDaySum,Type)

Type,LeanPeriod,GoodPeriod
1, A<5 , A<20
2, 5<=A<=10, 20<=A<=40
3, A>10, A>40


LeanPeriod=Jun to Nov
GoodPeriod=Dec to May

View 1 Replies View Related

Is It Possible To Use Variables In Sql?

May 13, 2007

Hi there, is it at all possible to use variables in sql? Please consider the following snippet:

... (WHERE [DateDue] < Date())...

The idea is to return a recordset where the DateDue is prior to the current date. But sometimes I need the opposite, ie a recordset where DateDue is in the future: ... (WHERE [DateDue] > Date())...

Right now I have 2 long queries which are exactly the same, except for the operator < for the first case above and the operator > for the second.
I of course did not want to repeat the queries so I tried:

Dim op As String
op = Me.txtOp 'txtOp is invisible and gets its value (either "<" or ">" ) thru
'a button click
... (WHERE [DateDue] & op & Date())...

I also tried:

... (WHERE [DateDue] & forms!frmInvoices!txtOp & Date())...

But to my "surprise" both failed.

Can it work? what should I correct or do differently here? I might need this kind of trick for other routines too, so I'd like to avoid copying the same query, just for the operator change.
I hope one of you seasoned sqlers can tell me more about it, I appreciate.

Regards,
Jaime

View 10 Replies View Related

Sum IIf And Three Variables

Mar 3, 2006

I want to create a field named ErrorCases that sums the rows meeting the following conditions: The row has a ValidityReason = 2 and for the same row ExpValidity is either null or 3. I want a count of the rows meeting these condtions.

Here is the formula I have constructed that does not work.

ErrorCases: Sum(IIf(([ValidityReason]="2" And [ExpValidity] Is Null) Or ([ValidityReason]="2" And [ExpValidity]="3"),1,0))

Any suggestions?

View 2 Replies View Related

Using Variables

Jan 14, 2005

I am trying to incorporate the following code into my code:
Code:If Not QueryExists("Q_ABC") Then Set qdf = db.CreateQueryDef("Q_ABC") Else Set qdf = db.QueryDefs("Q_ABC") End If
Difference is that I want to use a variable to provide the query name...
Code:dim queryname as variantqueryname = "Q_ABC" If Not QueryExists(queryname) Then Set qdf = db.CreateQueryDef(queryname) Else Set qdf = db.QueryDefs(queryname) End If
but this does not work... but neither does this...
Code:dim queryname as variantqueryname = "Q_ABC" If Not QueryExists("queryname") Then Set qdf = db.CreateQueryDef("queryname") Else Set qdf = db.QueryDefs("queryname") End If
nor does this...
Code:dim queryname as variantqueryname = "Q_ABC" If Not QueryExists queryname Then Set qdf = db.CreateQueryDef queryname Else Set qdf = db.QueryDefs queryname End If
Can someone please show me how this is to be done?? I feel that it must be something simple...
Thanks a lot (in advance)!

View 5 Replies View Related

SQL Variables

Oct 28, 2007

The following code recognizes the value of 'TheYear' after running the line of code (ie. "#11/13/2007#"). The problem is it doesn't seem to recognize it in the SQL, but rather asks for a value when I reach the SQL code line. How can I get it to substitute automatically? THANKS!
DoCmd.SetWarnings False
TheYear = "#11/13/" & Year(Now()) & "#"
DoCmd.RunSQL "Update [Employees Trained List] SET [Employees Trained List].[This Years Training Date] = Null WHERE (([Employees Trained List].[This Years Training Date])< TheYear );"
DoCmd.SetWarnings True

View 1 Replies View Related

Program Working In Access 2007 Not Working In Access 2010 Due To Missing OCX File

Dec 27, 2014

I have a program that runs under access 2007 that I use at my work. We will soon be updating to MS office 2010 and the program will not work now because a calender file .ocx was removed from access 2010. Is there a way to get the 2007 .ocx file to work in access 2010?The program I am using is a relatively simple stand-alone and unsupported app that we use to request patient arrival and departure from various radiology tests inside a hospital. No reports are made from the app other than the number of patient transports for the day.

The app is placed on a common drive accessed from any pc in the hospital. No special permissions are required. But our app does use the calendar, time and date functions in access 2007. When I tried the app on a pc with access 2010, it basically says it (access) cannot open the app because a .ocx file is not present.Is there a way to make the access 2010 calendar file work in access 2007?

View 1 Replies View Related

Holding Variables

Mar 9, 2006

I have started holding variables in text boxes on forms - (variables needed at module level for that form).


Is this a correct thing to do.

The benefits I have are not loosing the value should some error occur - and being able to reference it from another form.

Thanks

Paul

View 3 Replies View Related

Query Using Variables

Mar 6, 2008

I am currently making a project as part of my Computing course. The project is a running diary, where users can log in and record their running times(Amongst other things). As part of the system i am going to include a calorie calculator, to do so i have to work out the BMI (Body Mass Index). To do this you have to divide the weight by the square of the height. The weight and height are stored in the tables.
I am planning on creating a form for this conversion which will refer to a query. When the users log-in their ID is stored in a Public Variable called "UserID".
What i would like to do is query the database for their height and weight using this variable, but i don't know how to go about doing this.
Does anyone have any suggestions?
Many Thanks

View 6 Replies View Related

Linkcriteria Using 2 Variables?

Nov 2, 2005

Hi

Currently i use one variable as indicated below from a continuous sub form field to open another form

Dim linkcriteria As String
Dim frmRoom As String
frmRoom = "frmRoom "
linkcriteria = "[HeadCloseID] = " & Me.HeadCloseID
DoCmd.OpenForm frmRoom , , , linkcriteria

however, after restructuring some tables, i need to open the form with respect to 2 variables instead of the previous one.

hence my question is can, how, and what code would i use to do this

many thanks in advance

View 3 Replies View Related

Global Variables

Feb 13, 2006

I have an access form called forma. It has a command button. When I click a command button, FormB opens up and FormA closes. The FormB also has a command button. When I click the command button of Form B, it closes and opens FormC. Like this there are total 30 forms. What I need is. I want to count the no. of clicks of the command button in total. Actually each button is a correct option of A multiple choice question. I tried to declare a public Variable called total in the declareation of the first form and tried to use it directly in the succeding forms. It does not capture the values. How can I increase the value of the varialbe declared in the first form even after the form closes and capture till end. Actually I also should be able to send the value in a table. Please Help Me.!

View 2 Replies View Related

Duplicate Record Command Button Not Working For One Form But Is Working For Other Form

Jan 15, 2015

I have an Access 2010 database with two tables and two forms. The tables are Organizations and People. Similarly, the forms are Organizations Entry Form and PeopleEntryForm. The People are linked to the Organizations table. Several people can be linked to the same organization.On my Organizations EntryForm, I created a command button to duplicate a record using the wizard. It works fine.

I did exactly the same thing on the PeopleEntryForm, but instead of copying the record, it creates a new blank record. I don't get any error messages. Is my problem due to the fact that the People table is linked to the Organizations table?

View 13 Replies View Related

Environment Variables In 2007

Jul 10, 2007

Just updated to Access 2007 from 2003 and my app does not pull in any environment variables. =environ("variablename")

Anyone else have this problem?

View 5 Replies View Related

SQL Pass Through Form Variables

Feb 3, 2008

I know this is probably obvious but how do I pass through form variables to sql server I currently have:

exec QStudent @_param_cmbYear="0708", @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"

this executes correctly SelID being a student ID or partial ID also allowing for surname forename partial search. I thought it would just be:

exec QStudent @_param_cmbYear=[Forms]![Attendance and Lateness Main]![cmbYear], @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"


to switch acad year to a form variable and repeat for the others but it errors on trying to save the pass through. Thanks for the help.

View 1 Replies View Related

Can Variables Be Used In A Form Control??

Mar 5, 2008

hi all, Newbie to access and am making an asset tracking database for work. I have written a sub that opens a hidden form and queries it. I want to get a value from that hidden form and stick it into a combo box on my origianl form. I have got most things to work. The problem i am having is using a variale in a control form i.e. [forms]![ & strVar & ]![Field] here is the code i have so far
Private Sub Form_Search(strFname As String, strField As String, strFField As String, strWhere_Next As String)
Dim strWhere As String
strWhere = strField & " = " & "" & strFField & ""
strWhereA = "[Forms]![" & strWhere_Next & "]![ALLOCATEDTO]"
DoCmd.OpenForm strFname, acNormal, , strWhere, , acHidden
Me.ALLOCATEDTO.Value = strWhereA
DoCmd.Close acForm, strFname


the strWhereA shows the correct field but is shown as [Forms]![Formname]![ALLOCATEDTO] in my combobox, not the actual value of that form. Please help. I know this is probably a simple syntax error but am now at my wits end!!!

Thanks in advance!

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved