Forms :: Subtract Value From Combobox Depend On Value In Other?
Feb 22, 2014i want to substract value in combobox, but the source of the other combobox is in other table then Form query shows. How can i do that?
View Repliesi want to substract value in combobox, but the source of the other combobox is in other table then Form query shows. How can i do that?
View RepliesI have a combo: cmb_TrainingType. The sql is:
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.
Situation: 3 tables. Manufacturers, Countries & Provinces/States. 1 Form for data entry in Manufacturers.
Countries table contains ID, Country and CountryCode fields. i.e. 47, Great Britain & GB
Provinces/States table contains ID, Province/State and CountryCode. as in 1, Alaska and US.
In the form the country is easily selected from a list refering directly to the Countries table.
Problem: How to make a list in the form from which the user can simply select the province for the country that has previously been selected. And not a list with all teh provinces and states from every country in the world. (This would be a really really long list...)
I have a table in wich I have stored numbers and i want to subtract them using vba.
example
Table1
ID number
1 20
2 40
textbox(ID):2 texbox(value):5 button(subtract)
So when i click button i want to subtract record with id 2 (40-5=35) and i want the new value to rewrite the previous one in the table.
result:
Table1
ID number
1 20
2 35
I want to know if it's possible to do this in vba.
I am trying to use a combobox called Manufacturer to select which table the combobox called Model gets it's rowsource from using the code below.
Code:
Private Sub Manufacturer_AfterUpdate()
If (Me.Manufacturer.Value = "Siemens") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SeimensTable"
Me.Model.RowSource = "SELECT Model FROM SeimensTable"
Else
If (Me.Manufacturer.Value = "Samsung") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SamsungTable"
Me.Model.RowSource = "SELECT Model FROM SamsungTable"
End If
End If
End Sub
But when I run the form and select Manufacturer. Combobox Model remains empty. tell me what I'm doing wrong?
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?
Any help would be greatly appreciated.
Hi,
I have a problem and I need any help I can get!
I have a master form (MasterForm) and a subform (SubForm).
in the SubForm I have 2 comboboxes (Institution) and (Office).
Each Institution has a number of Offices.
What I want is:
Based of the Institution the user choose, the offices that belong to this instituion will appear in the combobox.
How can I do that?
Regards,
CS.
Dear all,
I am trying to do the following on a form:
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?
Thanks for your help.
Itschak.
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.
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
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
GetTotalTime = H & ":" & DM
End Function
Many thanks
Mick
Hi
I want to make a button which when clicked will bring up a box which the user will enter a number which will then be subtracted from a number in a field.
I have tried an update query however not been able to getting it working.
Any ideas?
Hi,
I have a query with two fields. One has the "MEASUREMENT" and the second one is the month containing the values. In the MEASUREMENTs I have gross revenues and discounts, how can I create a new MEASUREMENT (net revenue) that is calculated by subtracting the discounts from the gross revenue.
Regards
Giannis
Hi, I hope someone can help me out with this problem:
I have 2 tables with identical stucture, and no unique ID number.
Both had identical data, and the databse was then copied onto 2 laptops. Now further data was added onto each.
I want to now merge the three databses (ie original one, and 2 laptops) into 1, without creating duplicates- so I need to identify which are the new fields added to the databases. I figured that by somehow subtracting the original table from the new ones, i would be left with the new data, but dont know how to do this. Or is their another way?
:confused: Need help building a query that will subtract the previous value from the next value at each change in date
Date Tier 1
1/6/2006 4.22
1/13/2006 4.27
1/20/2006 4.27
1/27/2006 4.314
2/3/2006 4.314
for example, 4.22-4.27 = -0.05
If there is such an animal...
My employer uses a third party employee tracking system and I do back end work to massage the raw data for ad hoc reports using tables created by this third party software.
Is there a simple means to have a query compare Table A and Table B where Table A is a list of all jobs in a company - both filled and vacant - and Table B is a list of all employees in the company? The table containing jobs data has no field designating whether a job is filled or not. The only way to determine vacancies is to compare the two tables and select only those job numbers where there is no matching employee.
So, using examples from an earlier question - one that KeithG answered perfectly - let me see if I can demonstrate what I'm trying to do...
The Jobs table has two fields; JobNum and JobDesc.
The Employee table has three fields; EmpNum, EmpName, JobNum.
Here's Table A, Jobs;
100, Boss
105, Aide
200, Manager
201, Worker
202, Worker
Here's Table B, Employees;
111, Montgomery Burns, 100
112, Waylon Smithers, 105
121, Homer Simpson, 201
122, Lenny Leonard, 202
Jobnum is the link between the two tables in the query and the query's fields are;
JobNum and JobDesc
The result I need is;
200, Manager
The only vacant job.
So, how do I do a subtract query, if that's even a proper term? How do I have a result that is all of Table A that does not have a match in Table B?
Thanx!
I have a report based on a query where I get results sorted by month after i have chosen 'from date' and 'to date' in the beginning. I also want a set number for each month to be subtracted from the total sum, and then added to the next month (even if it is a negative number). Ex. Total in january is 100, then it is supposed to subtract 50 from that number, report the result of 50 in one own field at the end of january, then send this to february where the total sum is ex. 200, then the total sum for february is supposed to be 250, and then again a different number, like 60 is automaticly subtracted from the total sum and displayed in one field as the result 190. And so on.. Does anyone know if this is possible, and how? I am a noob, both in access and in the english language :P
View 1 Replies View Related(hard being a rookie)
On my Form, I want to have a query look at one specific field for a number (1). If the number is found then I would like to have the query do basic subtraction on two other fields. (one from each table)
What I have so far is one unbound text box with the following,
=IIf(tblDaStrategy!DaNumber=1,(tblDaStrategy!DaTar get-tblDaReport!DaActual1))
Simply put, if one field has the number one in it, then take the other two fields and subtract (ex. 100-75) to display 25.
It's not working. I keep getting the #Name?
Update: I think I got it. I went back to square one and made a master query that contains the data from both tables. Then I bound one of the forms to the query. I updated my IIF statement and poof. It seems to be working. Now, where's the Asprin and my pillow?
Update 2: Bummer, now my magical 25 is in place but now my form is locked tight. Guess I need to consider abandoning this concept and simply producing a report with the 25 on it. Unless someone out there has a better idea.
4/11/2007 1:01:28 AM
4/12/2007 2:02:52 AM
4/13/2007 4:21:30 AM
4/14/2007 2:22:21 AM
4/15/2007 3:34:53 AM
4/16/2007 4:02:37 AM
4/17/2007 5:03:15 AM
4/18/2007 7:17:34 AM
I need helps again
How can I subtract 7 hour from the query
Thanks
Hi,
Working on a query, what I have is a user will select a date on a form and hit submit.
I need the query that it runs, to pull all data -1 day from what they select.
So if they select 10/31 on the form, it needs to pull everything for 10/30 only.
I have this in my query now,
[Forms]![frm_change_report]![txt_Date]
Which pulls the data for the date they selected, but not sure how to subtract a day.
I'm sure this is simple but my brain is mushy this morning!
I have two datetime fields ADMISSION and DISCHARGE with values such as 03/02/2008 15:00. How do I convert these to dates only? I don't want to just *format* them as dates, which I can do. In this example I would want to convert that date to 03/02/2008 (or 03/02/2008 00:00)
It's an idiosyncrasy of the way the NHS calculates hospital length of stay. Our previous IT system had dates and times in separate fields so I could just ignore the time field and work out length of stay based on dates only. However, our new system returns a combined datetime.
Patient A 03/02/2008 00:15 to 03/02/2008 23:45 = 0 days
but
Patient B 03/02/2008 23:45 to 04/02/2008 00:15 = 1 day
Basically, you count a day if there's a date change, even if that was only half an hour (or even a few minutes) either side of midnight, but you DON'T count a day if there was no date change, even if that was almost 24 hours.
So formatting them as dd/mm/yyyy wont work ,as I will still have partial days when I subtract one from the other and INT([DISCHARGE]-[ADMISSION]) wont always work either as it would calculate 0 for patient B.
Help!
I have a table that has two fields; odometer reading and reading date. I want to able input the reading dates along with the odometer readings. Then I want my query to calculate the milage difference between each date.
Example:
DATE READING DIFFERENCE
9/1/04 35000
10/1/04 40000 5000
11/1/04 42000 2000
And so on.............
Thanks in Advance - John
I having a problem with Access
I have one row in table, for example:
km_counter
18000
18100
18300
18800
and when I run a query, I want to get:
km_counter km_diff
18000
18100_____ 100
18300_____ 200
18800_____ 500
is it possible to do that?
I have two date fields. I want to subtract them to determine the number of days elapsed. The dates are in the following format: Dateserial (Year, Month, Day). When I subtract them I get 7670 as the result when the number should be 365 if they are a year apart. How can I subtract the dates in a query?
View 3 Replies View RelatedIn my database I have a list of organizations with a certain goal. If that organization can not hit that goal we have to "reallocate" the left over goal to another organization. As it stands now I have the following fields, Goal (which should stay stagnant), change (to either subtract from one organization and add to another) and New. What I would like to do is have a way to have a way to calculate if there is a change to maybe have a drop drown that when the change is subtracted I can add that to "new" of another organization.
View 3 Replies View Related