How To Display The Result Of A Substraction Of Two Box
Oct 9, 2006
Hi All,
I am trying to display the result of the difference between two boxes in a new unbound text box.
Basically, I have a box called "Initial Downtime" --> display the system downtime
Than another box called "uptime"--> display the time the system cam back up.
I would like a third to display the difference between the two time
Any ideas on how to do this in a form?
Any help will be gratelly appreciated
View Replies
ADVERTISEMENT
Jun 23, 2005
This is a code I used for a stock control form:
"Balance" =[QuantityReceived]-[Stock record table Subform].Form!SumQtyIssued
It is just a simple substraction between a record from a field and a sum of records from an another field contained in a subform.
The code is working fine apart for the following situation:
If there is no data, yet in the subform;the value for the "Balance" which should be Just equal to [QuantityReceived] appears for 1/2 a sec and disappear!!????
Just now, my knowledge is pretty poor with codes but what i guess is that Access start the calculation fine, then realised that there is no data in the subform and then cancel the calculation.
How can you set the value of a field to 0 or cancel that part of the equation if there is no record for that field?
View 2 Replies
View Related
Jul 12, 2013
the [EFS] and [CB] is one of the team for handling the project but after I execute the query as below , it just show -1, 0 as the picture but they are orginally Yes/No box from the table, how can I display the result as a Yes/No box instead of -1 ,0
--------------------------------------------------------------
SELECT Projects.[Project Name], Projects.[EFS],Projects.[CB]
FROM Projects
WHERE (((Projects.[EFS])=Yes) AND (([Forms]![A]![EFS])=Yes));
UNION SELECT Projects.[Project Name],Projects.[EFS], Projects.[CB]
FROM Projects
WHERE (((Projects.[CB])=Yes) AND (([Forms]![A]![CB])=Yes));
View 1 Replies
View Related
Jan 7, 2007
Hi,
I'm trying to work out a formula in a query.
At the moment it looks like this:
Days on Hold: calcworkdays([on hold date],[off hold date])-1
Now i have a module thingy set up (calcworkdays) which works out working days. What this expression does, when theres an on hold date and an off hold date is work out how many working days something is on hold.
Now, problem is, not always is something on hold, therefore fields are often blank and then i get a result in query that says "#Error", but i want to use the answer to this expression in another formula, but when error is displayed it makes the other query show error too.
What I want is some sort of If statement or similar so that if no results exist to display "0". Can anyone tell me how to add this in?
I'm a total Access Noob, it took me forever to work out this working days thing (damn access for not being as simple as excel!)
I think my problem might lie in the way the function has been written. I think i might have to modify this to show "0", rather than "error"
This is what ive got in the function.
Public Function calcWorkDays(dteStart As Date, dteEnd As Date) As Long
Dim i As Long 'day counter
Dim dteCurDay As Date
'set i = 1 if you want the first date to count as a full day
'or i = 0 if you do not want the first day to count as a full day
i = 0
dteCurDay = dteStart
Do Until dteCurDay >= dteEnd
'check date against holiday table
If 0 = DCount("[HolidayDate]", "tblHolidays", "[HolidayDate] = #" & dteCurDay & "#") Then
'continue checking for weekdays
If Weekday(dteCurDay, vbSunday) <> vbSunday And _
Weekday(dteCurDay, vbSunday) <> vbSaturday Then
i = i + 1
End If
End If
dteCurDay = DateAdd("d", 1, dteCurDay)
Loop
calcWorkDays = i
End Function
Any help would be much appreciated!
Thanks
View 1 Replies
View Related
Jun 22, 2005
I wish to print the result from query in a subform. In my main form, I had a textbox call 'year' which asking user to input a valid year. The query will have to find out all the records that are in that particular year, one year before and one year after. After that, it should display the result in datasheet form. Can anyone out there help me in this matter?
My second question is Can we use crosstab query in the subform?
Thank you.
View 2 Replies
View Related
Dec 28, 2012
I have two forms...frm1 has a text box with an expression in it and I need frm2 to display the result of the expression. I'm using the DLookup expression and it either gives me #Name? or #Error? message in the text box frm2.
=Dlookup("[loan#]","tbl_loan","[Days] =" & Forms![frm1]!Days) <that gives me #Name? message
View 7 Replies
View Related
Apr 12, 2006
Hi All, I hope someone can help with this, I have 2 tables, 1 main table that holds all my part data ( ie part num, description, etc) and a second table with vendor info. On my Form I have all my fields that display the record. I placed a combo box on my form that I need the user to be able to select a vendor, which is working but I need the form to show the vendors part number in a field. The main table has a manufactures part number, and I have 3 fields that have my 3 vendors part numbers for that part in it. I have the combo box so that it shows the vendor name but how do I get it to look at a certain field for the vendor part number. Im still really new to Access and am clueless any help would be greatly appreciated. I know I have not explained this every well so I am attaching a sample of the DB so you can see that I have Thanks again
Thanks everyone..
View 4 Replies
View Related
May 1, 2008
I would like to allow users create a query and then display the result in a new table. Just like the regular way in Access.
I know how to do it using DAO. However, I am working on a ADP, and want to use ADO for this. I cannot find a solution in ADO. So frustrated!
Any help is appreciated!
View 5 Replies
View Related
Nov 30, 2004
It's written a Function which takes an Integer as Arg, runs a Select Statement and returns a String.
Such that the Control Source of the Forms reads....
=ConvertCompanyNumbers([12]) = where [12] is the Name of the field. Not My choice to have numbers as Fields.. but there it is.
Anyway.. I'm getting an #Name? error... also tried [Ctl12] but again same error.
I know the function works, as I can use something like =ConvertCompanyNumbers(12) and it displays the appropriate result.
What is up with this?
View 2 Replies
View Related
Dec 10, 2012
I have a database that I have created for work. On the form I have several dlookups running. A couple of them show up as expected. But most of them are showing up blank. That is until you click on the box, then the result appears. Changing the Locked and Enabled settings does not resolve this.I have the database locked up for normal users. When I access it by holding shift while opening, when I access this form, the dlookups all show the desired results. No clicking on the boxes required.
I've tried refreshing, but that doesn't work. If I write code that loops through all of the textbox controls, setting focus on them and moving throuhg the form, then the results will show up. Basically having VBA click on the boxes for me. Although this works, there is a slight lag and screen flicker as it sets focus to all of these textboxes.
View 4 Replies
View Related
Nov 18, 2014
I'm trying to use the job number field, which is my primary key in my table, to auto assign the new job number on my Forms. Currently, I have to enter a new job number manually, and it has to be unique because that is the way I have it set. I can't use autonumber because Access does not allow you to select what number you would like to start from, which would not play well with my current job numbers.
Basically I need Access to get the job number from the last record and add 1 to it, or just find the last / highest current job number and add 1 to it.
I created a query (qryFindJob#s) that list all of the Job Numbers, but I'm not sure how to add the query results to my Form to display the Job number + 1. I created a text box, typed a simple expression in the control box to see if I was on the right path (=[qryFindJob#s]) but I keep getting a #Name? error in the txt field.
View 7 Replies
View Related
Mar 25, 2013
I have a result for a query made from four different tables for which I would like to refine the result of this query grouping multiple rows into columns.
Attached is a pdf file showing the results being obtained by my query and underneath is how the result would like it be after running the query.
I am currently using Access 2010.
View 5 Replies
View Related
Jul 20, 2005
Here's the form I'm trying to Create:
VEH POS NAME
A21: TC: CPT Somebody
G: SGT Someoneelse
D: PVT Noone
A22: TC: SFC Smith
G: SGT Jones
D: PVT Doe
and so on and so forth.
The VEH and POS are just going to be Labels in a form....no prob. Each Soldier's Squad and Team (for mounted Vehicle and Position) are stored in the Personnel Table. The below query is for vehicle A7 (ACTUAL would be the same as TC above). The query works. I just need to know how to get the result to display in a text box. What I'm planning on doing is creating text boxes for each posistion with these small select queries, so when I update the SQD and Team in the Personnel Table it updates on this form. Or is there an easier way to do this?
Dim strSQL as string
strSQL="SELECT [tblPERSONNEL]![RANK] & " " & [tblPERSONNEL]![LAST_NAME] AS NAME
FROM tblPERSONNEL
WHERE (((tblPERSONNEL.SQD)="A7") AND ((tblPERSONNEL.TEAM)="ACTUAL"))"
View 3 Replies
View Related
Jun 24, 2014
My question is that can we do multiplication of data of two columns and result is automatically displayed in third columns in datasheet view.? Is it possible ?
View 1 Replies
View Related
Sep 2, 2014
I want VBA code that will perform the following steps. The Table1 has following fields:
ScanDate,NewBatchNo,BatchNo,PolicyNo
1. First of all look into Table1 the scandate<=29082014 and then check if there is No NewBatchNo of the corresponding record then capture its corresponding BatchNo of each record whose scandate<=29082014
2.Then check for the batchno that we have captured in another table Table2 and if its present then return corresponding PolicyNo. Now keep on searching that policy no in Table2 as it could be present 50 times in the table and then return corresponding batch numbers in excel sheet of that Policy No as below:
BatchNo - Policy No - Batch No1 - Batch No2 - Batch No3 ---------------
View 1 Replies
View Related
Jul 3, 2014
I have the need to display the return of my "Sum Query" to display in a text box.
I need the attached below value (40500) in the "SumofQuery" attachment, which updates every 5 minutes to display on the "StatusBoard" attachment text box.
I have been searching for a good 10 hours on how to do this and still cannot find it.
View 14 Replies
View Related
Jun 25, 2014
I have saved query object named qrySearchBill. I wan to call this query through vba and display the result in a subform named subQrySearchBills in datasheet view. Here's how I want it to work:
When the main form loads, I want all unfiltered records to be displayed in the subform initially. The user may then decide to filter based on date range, so he enters startdate and enddate parameter values in their respective textboxes in the main form. Then click search button to run the saved query based on the date range parameter taken from the textboxes.
I have this code so far:
SQL of the saved query object:
Code:
PARAMETERS [StartDate] DateTime, [EndDate] DateTime;
SELECT tblInvoice.BillNo, tblCrdCustomer.CstName, tblCrdCustomer.CstAddress, tblCrdCustomer.Island, tblInvoice.Date, Sum(tblInvoice.[TotalPrice]) AS Amount
FROM tblCrdCustomer INNER JOIN tblInvoice ON tblCrdCustomer.IDNo = tblInvoice.NameID
WHERE tblInvoice.Date Between [StartDate] And [EndDate]
GROUP BY tblInvoice.BillNo, tblCrdCustomer.CstName, tblCrdCustomer.CstAddress, tblCrdCustomer.Island, tblInvoice.Date;
vba code to call the query and its parameter:
Private Sub btnSearchBill_Click()
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set qdf = CurrentDb.QueryDefs("qrySearchBills")
[Code] ...
This code works fine except that when the main form loads, a prompt window appears to ask for the value of dateStart and dateEnd. I don't want it to prompt because it's suppose to get these values from the main form's textboxes (txtStartDate and txtEndDate respectively), plus it should initially display all the unfiltered records.
View 3 Replies
View Related
Jun 15, 2013
Is there an easy way of entering a value in a text box, passing to a query to do a count function and then return the value of count function in to anther text box?
View 5 Replies
View Related
May 13, 2005
First, I am a beginner with Access. I am a graphics designer that has been assigned to cover for a db programmer that quit!
Here is my problem:
I have a database that we use to hold customer information. There are 22 fields in each record, and we are now well over 3000 records.
Once upon a time, to find a specific customer, we would just go to the bottom of the page, and use the arrow buttons to scroll through them all. This is no longer possible as the size is too big to manually search.
What I would like to do:
Upon Access startup, display a form that has a single input field and a button titled "Search". The input field is titled [UserName], as this field is the unique key identifier for the record. When the user types in the UserName and clicks the SEARCH command button, another form appears to display JUST THAT RECORD in the easy to read form!
If this is really basic, I appologize. I have 20 years experience with commercial illustration and only 7 days experience with Access. I have purchased books, and hit the forums, but I am not a VB programmer, and my skills this area are REAL weak!
My resourse books include the following:
Wiley - Access 2003 Bible [Prague, Irwin & Reardon]
Osbourne - How to do Everything with Access 2002 [Anderson]
O'Reilly - Access Cookbook [Getz, Litwin & Baron]
Thanks in advance for any assistance.
View 3 Replies
View Related
Mar 5, 2014
I am working with Access 2010, on vista. What I have is a query made up of two tables, one product the other inventory. (see below) query.jpg
In the product table i have a field called "minimum reorder level". In the inventory table i have two fields one called "number in stock" and "number on order". What i want to happen is "number on order" to be filtered by the result, if the "number in stock", is less than "minimum reorder level", if it is, have the result placed in the "number on order" field. EG. if the "number in stock" = 2 and the "minimum reorder level" = 5 then 3 would be placed in the field "number on order" and only the second record from the query would be visible (see below) Query result.jpg The result of this would mean that the field "number on order" would be populated with the result and the and query would also use this to filter the record.
View 1 Replies
View Related
Aug 18, 2013
I want to add a number to my results within a query depending on the month and how many results. For example I have 10 results in my query 3 from January, 5 from March and the rest from April. The 3 from January would be 1,2,3. The five in March would be 1,2,3,4,5 and so on. Is it possible to do?
I'm using access 2003.
View 4 Replies
View Related
Oct 12, 2013
I there is no result in query, I need the default result zero in my form field. I only use query wizard to create queries.
View 5 Replies
View Related
May 29, 2007
All:
I'd like to make the result of my text box flash (in my form) if the its value is less than 30..For example. If A - B < 30, then the result whatever it is as long as it is less than 30..Is this possible in Access? thanks in advance.. :
View 1 Replies
View Related
Sep 29, 2005
Hello guys,
I Have a table call Hq_Cases in oracle database,I created same table in access 2000,and I created a SELECT QUERy in access ,now when I run this query it shows me empty table,so I want to know how I can bring values from oracle into my access database.
Any suggestion is appreciable.
Thanks
vsap
View 3 Replies
View Related
Apr 26, 2006
Hi,
Im getting an odd result returned & I don't know why.
expression:=[lookup]*[yards]+[drop]:=0.296*30+-11.838
Result:=1.20E-27
If I replace value [drop] with -11.838 then the result is correct (-2.958)
ie:lookup]*[yards]+-11.838
The porblem seem to be when [drop] is neg.
View 1 Replies
View Related
Sep 20, 2005
how can i get the result from a query in to a variable, i want to use this result in a new query?
View 3 Replies
View Related