Posts

Showing posts with the label ms-access

SQL query to select everything from 1 table and 1 column(same name as in table 1) from another table

SQL query to select everything from 1 table and 1 column(same name as in table 1) from another table I have 3 tables. table1 : Products: ProductId Category Model Price Quantity table2: OrderLines: OrderId ProductId Quantity table3: Orders: OrderId CustomerId (theres also a customer table but it doesnt matter) Now I want to select all the products data from Products table that have ProductId = ProductId in OrderLines table, but get the quantity data (of those same products) from the OrderLines table. Tried all kinds of queries, couldn't find one that works. heres the last thing i kind of tried: SELECT tb1.* ,tb2.[Quantity] FROM [Products] tb1, [OrderLines] tb2 WHERE tb1.[ProductId] IN ( SELECT [ProductId] FROM [OrderLines] WHERE OrderId = @orderId) INNER JOIN [OrderLines] tb2 ON[Products].Quantity = [OrderLines].Quantity"; didn't worked. any suggestions? Thanks a lot. sample data: Orders: OrderId CustomerId 1 2 OrderLines: OrderId ProductId Quantity 1...

MS AccessJet SQL - staff clock in & out times, same table, sum full time worked per staff

MS AccessJet SQL - staff clock in & out times, same table, sum full time worked per staff I have the below table named 'timings'. It holds the comings and goings of staff members (morn_in, morn_out, afternoon_in, afternoon_out). timings table What I would like to achieve is an output grouped by staff_ref, SUM of their hours worked, like so; staff_ref| total_worked| U1 18:00 I currently use 4 separate queries to select each of the 'type' (morn_in, morn_out etc), the one for type='morn_in' is below, this query is called [101 am in] (it gets referenced later); SELECT staff_ref , time , Format([date],"dd/mm/yyyy") AS t_date FROM timings WHERE (((type)='morn_in')); I then SUM the DateDiff between the morning times; SELECT [101 am in].staff_ref , Sum(DateDiff("n",[101 am in].[time],[102 am out].[time])) AS morning_mins FROM [101 am in] INNER JOIN [102 am out] ON ([101 am in].staff_ref = [102 am out].staff_ref) AND ...

access forms: How to retain enable/disable options while accessing forms

access forms: How to retain enable/disable options while accessing forms I have a form and certain tabs are enabled and disabled according to the options chosen by the user. This works fine. But when I navigate through my forms later, i find that all the options are accessible and the user has to again select the choice to disable/enable the tabs conditionally. How to overcome this? P.s. I have used the Afterupdate() option to enable and disable tabs conditionally I am runnig the code in Access-vba @a_horse_with_no_name – malavika nair Jun 29 at 10:06 You have to call the code also in the event On Current – Patrick Honorez Jun 29 at 10:13 On Current @PatrickHonorez wh...