MS Access Query matching month from two date fields - ms-access-2010

I'm new to Access and am trying to figure out the best way to write a query. I have a table that tracks security entry information for each employee which has an Employee ID field and a date field [ENTRYDATE]. Another table (tblSPACE) lists out where that employee sits and is updated each month with new information. There is a field in tblSPACE which tracks what month the information is from. [ASOFMONTHYEAR]. These two tables are related by a unique employee ID number. What I want to do is have a query that shows the entry information and the corresponding seat that that employee was in for that month. I'm thinking I need to add a criteria into one of the date fields to have it match the month of the other date field? Something like Where Month(tblSpace.ASOFMONTHYEAR) = Month(tblEntry.ENTRYDATE). But of course that doesn't work. Any guidance on how I should go about this? Sorry if I've not explained this well.

Related

GSuite AppMaker - Populate datasource with distinct values from another table

I have a simple gsuite app with two data sources. One is a students datasource which stores student name, id, and demographic info. The other is a record of the attendance for the current day and contains name, date, and present (boolean column). Each student is unique and maps to one or more rows in the attendance datasource.
The goal is to be able to pre load the table with a set of students from the students table, leaving the date and present blank. THen the user can go down the table checking the boxes for who is in attendance on that day.
Is there a simple way to pre-load a set of records in the Attendance table based on the students table? Any good examples with explanation?
EDIT:
Here's what a data model might look like:
Students: FirstName:string LastName:string Status:string SiteName:string
Attendance: FirstName:string LastName:string Date:date Present:bool
The Students datasource would contain one record per FirstName, LastName. The Attendance datasource would contain multiple records per student, corresponding to each day that attendance data was captured.
Ideally, when displaying the Attendance table widget, I would pre-populate the table with a list of students for one Site. I already have a date-picker widget that updates all the date column values.

How to know what record I am in? Dynamics AX7

Here is the scenario:
In the Sales and marketing > Sales orders > All sales orders
I entered the lines by double-clicking the Sales order number
by doing that I am entering the lines of the sales order.
Now in my lines, there is a button there where I will use to add a syntax where I will insert fields in my newly created table.
I would like to know how can I know what record I am in (before entering the lines/before double-clicking the sales order number). I need to know what Sales order number I'm in as I enter the lines of the record.
In every form the current record of a specific FormDataSource has the same name of the FormDataSource. For example in the SalesTableListPage form the only datasource is called "SalesTable", so the current sales order record is identified in your code with the salesTable identifier.
Every record is extended from [Common]. There you have field TableId. You can get table name with [tableId2name].
You can inspect fields with DictTable and field* methods.

Filter column with numeric value, create new column

I think the title makes this sound possibly more difficult then it is.
Basically, I have a Table called Orders. 18 Columns.
The PK is called ORDERID(Nvarchar).
The problem child is a field called CustomerID(nvarchar). Prior to my assignment, this field use to be populated with raw customer information(Customer1, Customer 2 etc.) However, sometime ago, it was decided to insert just the number corresponding to the customer from the customer table and perform the lookup at the front end. The records that have the raw customer data are existent in the customer table but the lookup won't work when it tries to parse the CustomerID to the customer table, when the text is present. It results in blank fields on the front end.
OrderID(PK) Inquiry# CustomerID
Z1 I1 Customer1 (Look up on front end does not work)
Z2 I2 23 (Look up on front end works)
A couple foreseeable solutions.
Repalce old customerID with the corresponding customer number
Modify query on frontend to only show records that were created after the change to customerID(text -> #) Then push a new front end to everyone(around 80 employees)
Extract the records that have a text value instead of a number and create a new table called something like dbo.OldOrders Again I'd have to push a new front end.
Ideally I'd like to the accomplish the first solution if at all possible.
Anyone have any advisement?
Could you create a view that converts it into a number and then pull from there?

Enter data in mother table using data from child tables

Hi all,
I have 3 tables in an access 2010 database:
Crew: CrewID; Name; Adres;...
Voyage: VoyageId; Voyage name; Departure harbour; Arrival harbour
Crewlist: CrewlistId, VoaygeId, CrewId, Rank
The VoaygeId and CrewId from the Crewlist table are linked (relation) to the autonumber ID's from tables 2 and 1.
My first and main question is: Upon boarding everyone has to ‘sign in’ selecting the voyage and there name, and assign them a roll (of to be donde by the responsible officer). How can I make a form that lets the users browse through the voyagenames and crewnames in stead of the ID’s uses in the ‘mother’ table (table 3: Crewlist)
2nd question: how can I make sure that someone isn’t enrolled twice for the same voyage (adding same voyagenumber and same crewId number in crewlist). This would preferably be blocked upon trying to add the same person a second time on a voyage.
To prevent duplicates in Crewlist, add a unique index to the table on both CrewId and VoyageId
It would be a good idea to add relationships and enforce referential integrity
You are now in a position to use the wizards to create a form based on Voyage and a subform based on CrewList with a combobox based on Crew
There are a number of refinements you could add.
Make sure you do not use reserved words like Name and do not put spaces in field names. You will thank yourself later.
See also create form to add records in multiple tables

using single field for IN out tinme in table

we have a bio metric software for attendance, you press finger over sensor and it puts you IN/OUT time in SQL database, it's desktop app but boss asked me to make same but Web Application in asp.net MVC, now we have 2 tables
tblEmployee
SerialId
EmpId
EmpName
DepId
tblAttendance
AtdId
EmpId (FK)
Time(IN/OUT)
Date
now problem is that When i come into office then it put new record in attendance table and when i leave office then it again put whole record for OUT time in attendance table, it's using same field TIME for IN and OUT both. So thinking to solve this issue like Keeping single record for single day and only changing IN/OUT time ?
This look like normal behavior to me, but still if you want to achive what you have asked, you could change the table definition like this -
tblAttendance
AtdId
EmpId (FK)
Date --Just the date for every day
Time_IN
Time_OUT
Now you need to figure out which swipe it is - IN or OUT and update the particular value. For every IN there would be a new row - which you can control for a particular DATE - as in one row per DATE - Composite Primary Key - AtdId, EmpId (FK), Date
Note - Over the time the above approach will slow down the punch IN/punch OUT process. It'll take comparatively longer to register the swipes. Your current DB structure is more apt for long term usage. If you want to display the data in any particular format, you should rather design views as per your requirements.

Resources