Convert Mins:Secs To Hours:Mins Depend On Units Built
Dec 15, 2007
This is something I've been working on that very nearly works until it get to point DM
What I need to do is convert a build time for a single unit which is stored as mins:seconds into a build time depending on number of units being built then display the time as Hours:Mins.
I don't know of any functions in access that do this so have been playing with the code below which works upto the point of DM where I need to add the mins together then if more than 59 add the hour(s) to hours and then use the mins part as the total mins.
It needs a lot of cleanning up as been playing but hope somebody can help.
T = The Time IE 2:43
N = Number of units being built
Function GetTotalTime(T As String, N As Long) As String
Dim M As Double, S As Double, Y As Integer, MZ As Integer, MS As Long, H As Single, Min As Long, MM As Long
Dim DM As Long, Z As Integer
Y = InStr(T, ":")
If Y <> 0 Then
'Do The Mins Convert To Hours First
M = Left(T, Y - 1)
If M > 0 Then
M = M * N 'Minutes * Number Of Units
'Convert Total Mins Into Hours
M = M / 60
Z = InStr(M, ".")
H = Left(M, Z - 1)
'The Left Over Mins
Min = Mid$(M, Z + 1, Len(M))
End If
'Do The Seconds
S = Mid(T, Y + 1, Len(T))
If S > 0 Then
S = S * N 'Seconds * Number Of Units
If S > 59 Then 'Has Minutes
S = S / 60 'Convert Total Seconds To Mins.Seconds
MZ = InStr(S, ".")
MM = Left(S, MZ - 1)
'Dont worry bout odd seconds
Else
MZ = InStr(S, ".")
MM = Left(S, MZ - 1)
End If
End If
End If
'Now Add The Mins Together then / 60 to get hour /mins and add the hours to hours the remaining mins are the total mins element for build.
DM = MM + Min
I am going crazy! I have managed to do this in a previous database and now I can't remember how I did it.
I want to create a shortcut menu for a report that when I right click the mouse button it gives me the option to print. When I select print on this shortcut menu it goes straight to the printer instead of giving me the printer dialogue box.
I have a query result for example = 2.19 days worked. The result of cumulated hours divided by 8 (hours in the workday). What I want to do is take the .19 and multiply it by 8 (hours in the workday) and I would have the result in actual hours which is what I need. Or of course if there is a way to display that into 2 days and 1.52 hours Rounded up to quarters would be even better. But with spending hours looking through forums I didn't find a way to just work with the decimals right of the dot. Trim, format, Len didn't work for me, they all give me funny result.
I am drawing a blank on how to proceed with this requirement and was hoping someone out there could help me.
I am creating a graph that shows all of the orders we have taken, shipped, and what we have bid on. There is a table that holds the customer, no of units ordered, no of boxes per unit, number of units to ship each week and start date.
I need a formula that will calculate all of the week ending dates until the no of units ordered is 0.
For example, Capital ordered 100 units, 12 boxes per unit, 2 units to ship per week and shipments are scheduled to start on 2/19.
This information is diplayed on a graph. The graph shows all of our open bids and based on shipments per week, displays a forecast of what's coming up.
How can I place numbers side by side in the units, tens, hundreds etc
so if I have expr1, expr2, expr3........and I want them to appear side by side.
so expr1=1, expr2=3, expr3=0
This would appear as 130
However if expr1=0, expr2=3, expr3=0
I would like tis to appear as 030
I am sure I am going about this the long way but I am trying to create a query that wites out the full ip address i.e. 111.111.111.111.......not really sure to go about this so I am going to try and strip everything down to 1 digit and then rebuild!!! Unless anyone can think of an easier way to do this?
I have a table with some prices that are charged by the pound and some that are charged by each.
tblPrices ID 1 - 1.00 per pound ID 2 - 1.50 per pound ID 3 - 2.00 per pound ID 4 - 5.00 each ID 5 - 7.00 each
My form is set up so that way I count how many containers I have and their weight, separately. I need ID 1 through 3 to do the math based on the pounds (essentially $1 per pound at 36 pounds) and ID 4 and 5 to do math based on how many of each are there ($5 each, and there are 3 of them).
I have a database being used to track and bill therapy units. I have a table that stores the pre-authorizations that tells me within a [start date] and [end date] I am limited with X amount of units (that is all the client's insurance and/or funding source will pay for within the time period). I also have about 4 different codes I can be authorized for which is also stored in this table - each code a separate pre-auth record.
Another table is where I enter in the type of therapy (service code) I've completed with the client. I put in the Service date, start time and end time and it will automatically give me the amount of units to bill (1 hour=1 unit). If I happen to choose a code or enter in a service date that does not match up with a client's pre-auth (Service date is between start date and end date and matches code from pre-auth table) I have a simple text box that says "No auth for this code or service date" due to an IIF statement in a query. I'd like to take this a step further and give me the remaining units for the pre-authorization left when it does find a match.
What is happening is when it finds the authorization, it's not taking into consideration all the services I've done for that time frame. For example: I have a pre-auth from 12/1/12 to 1/31/13 for code 90806 for 12 units. I served the client for that code a total of 10 units thus far. I can't figure out how to link my 4 service records dated 12/3/12 (2 units), 12/16/12 (4 units), 12/27/12 (2 units), and 1/3/13 (2 units) to add together and then subtract from my auth for 12 units. I know the dates are the key but I'm lost.
I'm new to database designing, and my first project is to build a website and database for the proposal development department at my job.
After reading up, this is the design I've gone with:
Proposal Database
I know this is really complicated for my first project. There is a lot of many to many relationships that I'm not sure that I need. I've tried to normalize it as much as I could, but thought I would post it here to get professional opinions.
Also, is it possible to create a form that would update the junction tables between the make to make relationships? For example, if I wanted to add Criteria from the EvaluationCriteria table to the first Proposal in the Proposal table, would I have to go in and manually update the Proposal_Evaluation table each time?
field "A" is a combobox listing filed from a table (Field= CustomerName, Table=Customers). filed "B" is a combobox that have to list filed Contact.Name where Ciontct.CompanyName = <companynmae selected at te first combobox>. What is the field name containing the value selected in the first combobox? How to write a SQL that workds?
I'm trying to set up a database of books in a small library - each book has a prefix (Maths, English, Art etc) which I want users to be able to pick from a drop down list - I can do this, but the next field is a sub-category - is there a way of populating the dropdown list for the sub-category field depending on the chosen entry in the prefix field. eg if maths was chosen I would like the user to have the choice of number area, volume etc. but a different choice if the prefix was English.
any help very gratfully received - it seems to be a simple problem but it has me stumped.
Code: SELECT tblTrainingType.TypeID, tblTrainingType.Type FROM tblTrainingType ORDER BY tblTrainingType.Type;
My second combo (the one that should be filtered based on the Type chosen above) is cmb_Project_Title. The sql I have written (which isn't working) is:
Code: SELECT tblCourseDetails.CDID, tblCourseDetails.Project_Title FROM tblCourseDetails WHERE (((tblCourseDetails.TypeID)=Forms!frmResourcing.cmb_Training_Type) And ((tblCourseDetails.Type)=Forms!frmResourcing.cmb_Training_Type)) ORDER BY tblCourseDetails.[Project_Title];
Both of the tables that are referenced have the fields TypeID and Type.
I have a table called Locations that lists Countries and Cities:
USA, Detroit USA, Chicago USA, New York UK, London UK, Liverpool UK, Birmingham France, Paris France, Le Mans
I then have another table for inputing details on people I know. This table would have columns called Country and City. I've figured out how to make the Country column a "lookup column" so that I can only enter USA, UK or France. But how do I make the City column show only the appropriate list of cities relevant to the country that I've selected (e.g. Paris or Le Mans if France is the selected country).
creating dynamic RibbonXML where statement will depend on user that is accessing access database. I created DynamicXML no problem and it changes context depending on user but my main problem is refreshing ribbon. I see that UsysRibbons tables changes fine but it's not being loaded. I have to restart access in order to this to take effect. I tried gobjRibbon.Invalidate method but it doesn't refresh ribbon for some reason... Here is my code:I created new module with name "Ribbon" and put this in there:
Option Compare Database Option Explicit Public gobjRibbon As IRibbonUI Public Sub CallbackOnLoad(Ribbon As IRibbonUI) ' Callbackname in XML File "onLoad" Set gobjRibbon = Ribbon End Sub
and then in form that validates a user I put:
If (Not gobjRibbon Is Nothing) Then gobjRibbon.Invalidate End If
I just finished building my database and i have to install it on a PC. my problem is how to remove access tool bars and menues so that the only thing that appears when you open the databse is the login screen? I don't want the user of the database to be able to go to design view and change the design of the forms or the reports. I want the user to see and be able to interact with the login form and the switchboard. I wanna also know how can i install the databse on the PC. do i just copy it and paste it or is there any way else?
Hi, I have a database in Access 2000 format that runs just fine on my work PC which is running XP Pro and Access 2003. When I run it on my laptop (Vista Ultimate and Access 2002) I have a problem where it doesn't recognise the Mid function (or Left, right etc...for that matter). Everytime I try to run the query I get an error 3085 Undefined Function 'Mid' in Expression. Other databases work fine, it just seems to be this one. Can you please explain why this is happening and how I can get around it. Cheers
I went into tools, startup and unchecked allow full menus. Now when I open the DB, I don't have the tools menu so I can check the allow full menus. I need to get this back so I can continue working on the DB. There must be someway to get this back/reverse it.
I built a ms database and I'm just wondeirng about the compatability of using 2007, what kind of issues can i expect to run into and does this sound like there will be a major overhaul needed in the programing, or should it be pretty straight forward.
I am trying to remove the built in form views from access 97. Is it possible to remove the navigational functions of the form while in view mode (ie first record, previous record, search, next record, and last record)? There is also an arrow bar that has no functionality to it placed at the left side of my forms that I would like to get rid of. Is this possible? Thanks for your help!
I have a randomized table named tblRandomBoxes with the following data:
ID RandomID 1 4 2 5 3 2 4 6 5 1 6 3
I have 6 command buttons named command1,command2,command3, etc. and 6 Labels named Label1,Label2, Label3, etc. On Click of each command button, I want to lookup the ID based on the RandomID and set the backcolor of that label number to a different color.
ie) on command1 click me.Label4.backcolor = 39835
How can I 'build' the label number with the lookup? Here's the code I'm trying, but it doesn't recognize my 'built' label number:
Private Sub command1_Click() Dim ctl As Control ctl = "Label" & DLookup("ID", "tblRandomBoxes", "RandomID = 1") Me.ctl.BackColor = 39835 End Sub
I have a combobox on a form that lets the user select a business name which then populates the rest of the fields in the form appropriately. But when it does this it makes it so that the seach function at the bottom of the screen no longer works, as it only has the selected record as an option. So before selecting a name from the drop down list at the bottom of the screen is says "Record: 1 of 5" but after selecting the name it become "Record: 1 of 1." Is there anyway to still allow the built-in search function to work alongside using a combobox?