adding times to autofill a field VBA MSAccess - vba

I am making a booking system on MSAccess using VBA. On my form I have fields for creating a new booking which is then to be added to a database on SQL server. I have a combo box set up to allow the user to select and activity and it then fills out the ID of the activity and the duration of the activity. This duration is a number 1 or 2 or 3 etc for how many hours the activity takes.
However my question relates to calculating a finish time for the user. I wish the finish time textbox to be auto filled out when the user selects a start time from a list of times for example, 9:00:00 (To match the format the times are stored on the sql server) and having selected an activity by adding these together. So far I have tried something like this.
Me.txtFinishTime.Text = Me.cmbStartTime.Value + Me.txtDuration.Value

It could be:
Me!txtFinishTime.Value = DateAdd("h", Me!txtDuration.Value, CDate(Me!cmbStartTime.Value))

Related

Showing Stats on data with 2 Input Date Fields Apex 5.1.0.00.45, Windows

I have a table with 2 date fields and other columns. I have to be able to show stats on some of these columns between 2 dates that can be selected from a dropdown list.
All of this must be done in Apex. The client must be able to select a Start Date and an End date and then the count of for instance the number of Referrals between 01/SEP/17 and 30/SEP/17 must be shown.
The SQL code I used in Oracle to achieve this is:
select
'Total Referrals' as Details,
count(REFERRED) as Total
from PD_PATIENT_DETAILS where REFERRED = 'Yes'
and EVENT_DATE BETWEEN to_date(:EVENT_DATE) AND to_date(:EVENT_DATE_END);
I am now struggling to get this build in Apex. I only started working with Apex when I was brought onto this project. Have never worked with this before and am currently the only one working on it.
You can create 2 seperate page items and make them datepicker fields (P1_EVENT_DATE and P1_EVENT_DATE_END)
Your SQL query could look like this:
select
Total Referrals as Details
, count(REFERRED) as Total
from
PD_PATIENT_DETAILS
where
REFERRED = 'Yes'
and EVENT_DATE between :P1_EVENT_DATE and :P1_EVENT_DATE_END
Then you need to make an dynamic action (on change of one of the items, or make a go button) which submits the page or refreshes the report region (then you have to set the page items into the session state).
Something like this

How to display one row of data multiple times

I'm using SQL Server Management Studio 2014 and have one row of data that I'd like to display multiple times on a report. The data is shown below:
1 ACT 20117843-07 START 2/13/2017 FINISH 2/14/2017
2 ACT 20117843-07 START 2/13/2017 FINISH 2/14/2017
The current report has a group based on the Start date so the information would only appear once on 2/13/2017. However, I've had a request to display the same activity if it isn't scheduled to Finish on the same day as another row on 2/14/2017.
I've never been asked to do this before so I'm not quite sure how to accomplish the request.
You Can Add Adjacent Group to Start Date and FINISH Date in the report

How do I make a button that time stamps INs and OUTs

Good evening, I am new to MS Access & I am trying to figure out how to make a button that time stamps IN & OUT times/dates for a day care. (Also, another one for employees).
I don't know much about coding. Currently, I've got my ClientID as an employee number and their respective names and info linked to that.
But how do I create a simple to use button interface that would allow an employee to simply enter a name (or search), then click Sign In / Sign Out to time stamp that time to a field of records for me to later query for data, calculate cost of attendance, etc.
Thank you in advance.

Database mining, Auto Graph and email at certain time of the day

I have some automated machines running a Pasteurization process, sensors register values such as Temperature, time, pressure etc...
Our main control software does offers us a historic graph for such values, however its not possible to mail them. The software is able to log all the data into an Microsoft Access/ SQL database. For the company, our days start at 6am so a 24/hr period is meant to start again at 6 everyday.
Now the question:
Is there a way to mine the database (can choose either) to graph all the values from 6am last day to 6am current day (X,Y plot) Automatically in Excel, and have it Automatically sent to some mail recipients EVERY day at 6 AM?
If so, how can I do this?
You could get Excel to query the Access database (if the email recipients are in your LAN), so when you refresh the query (or you can get it do refresh automatically when you open the spreadsheet) it fetches the relevant information for the day only. So no emails would be necessary, as you always use the same spreadsheet.
To do this, first open your access database and create a view (query) to fetch the data you need (use this as a reference to get today's or yesterday's data: https://support.office.com/en-us/article/Examples-of-using-dates-as-criteria-in-Access-queries-aea83b3b-46eb-43dd-8689-5fc961f21762).
Then follow this tutorial to fetch the data from your view into excel: http://www.excel-easy.com/examples/import-access-data.html

Select certain rows from a result set. MS Access VBA

This could be bit complicated. I will try to explain as much as I can.
Say for example i have a table called "Job". In this table there will be multiple entries for a same Job ID (Job ID is not Unique). The current system enables a user to search for a particular Job ID and return all the rows having the same Job ID on a form as shown below:-
Job ID | Item Name | Date Completed | Generate Report?
------------------------------------------------------
JB001 Door 25/12/2012 []
JB001 Window 02/01/2013 []
JB001 Blinds 10/01/2013 []
JB001 Carpets 15/02/2013 []
I would like to implement a feature where a user can select multiple rows from this result set (using the check boxes) and generate another form/report form he selections. For e.g. if the user ticks check boxes next to Window an Blind and then clicks a button, the next form should display these selected rows.
By the way, I am using MS Access.
The problem I am facing is haven't got a clue as to how to implement this i.e to select certain rows from the result set.
Thanks in advance.
Perhaps youre thinking in too much code, could you formulate a query that uses the job ID from a form and the check box as a where condition?
You could base the report off of the query and as long as the form is open when the report is opened the query can use its fields. In the where box type [Forms]![frmFormName]![FieldName]
That should get you started.