Hi i have a combo box in a form (unbound form). The user has to enter some data, select a value from a combo box, push Save button, and then keep entering data until all the values from the combo are done. My combo has the RowSource Property set to a SELECT statement that retrieves all the data all the time. What i want: when the user selects a value from the combo and push the Save button the selected value gets removed from the combo. Example:
The combo has two values: -25 to 35 years
-36 to 45 years
The user selects a value :-36 to 45 years, enter other data and push Save button
As a result the combo should only have one option: -25 to 35 years
(after that it keeps on the same form, to enter data until no available options on combo)
Form: create a form with text box where you save select value with comma sparated string exmaple: "1","2","3" when you press the save button
Use the following SQL for the Dropdown, which will eliminate the selected value from the drop down
SQL query
SELECT Table1.Value
FROM Table1
WHERE (((Table1.Value) Not In ([Forms]![Form1]![Text0])));
Table:
table1
1
2
3
4
5
6
Result in drop down for above sql senerio
Result
4
5
6
Related
My question is about how to query multiple values in a field in a form in Access 2016. In the form, I have 3 textboxes: Date1, Date2 and studentID (txtstd_id)
In txtbox1 I select date 1
In txtbox2 I select date 2
In txtbox3 I type one value (e.g, student_ID)
Below I show SQL for dates and SQL for std_id. I used the query builder.
SQL1 = Between [Forms]![frm_search]![txtdatte1] AND [Forms]![frm_search]![txtdatte2]
SQL2 = [Forms]![frm_search]![txtstd_id]
SQL1 and SQL work well.
Now, what I need is to enter in txtstd_id more than one value -using OR clause- hoping that Access will returns all txtstd_id values between the date range selected.
Any idea is welcome.
I hope this example helps me to be clear:
I have a form with three text boxes: one for Day1, one of Day2 and one for Room.
The for also has a Search Button to run the Query
My Query sentence is:
SELECT tblsch1.datte, tblsch1.room, tblsch1.std_ID
FROM tblsch1
WHERE (((tblsch1.datte) Between [Formularios]![frm_Search]![txtday1] And [Formularios]![frm_Search]![txtday2]) AND ((tblsch1.room)=[Formularios]![frm_Search]![txtroom]))
ORDER BY tblsch1.datte, tblsch1.room;ter code here
For example in Day1 user selects 16/04/2018 and 21/04/2018 in Day2 and enter 6 in Room. Then. when a user clicks Search Button Access displays the query with desired data, otherwise displays "This period has no records".
With same date range user delete 6 and enters 9 and click again button search, then Access displays the query.
With same date range user delete 9 and enters 10 and click again button search, then Access displays the query.
What I am looking for is to allow a user in Room textbox to enter 6 OR 9 OR 10 at a time.
I'm a very new user of Access 2016 - I have a form populated by a query, and I want to create a hyperlink out of one of the text boxes. The link should include the combined values of the workday and taskID fields for the specific record the user clicks on.
My problem is that I can't figure out how to get the value of the current record. The control source for these columns are the values themselves, retrieved via the query populating the form's record source. The following code creates the link I want, but it returns the same workday and taskID values every time, regardless of what I click on, and I can't figure out how to make it respect the current record. Any help would be greatly appreciated!
Private Sub workday_Click()
Dim link As String
Dim workday as String
Dim taskID as string
workday = Format(Me!workday, "yyyy-mm-dd")
taskID = Me!taskID
link = "http://myurl.com/" & workday & "/" & taskID
Application.FollowHyperlink (link)
End Sub
EDIT - hope this helps explain a little better
The main table driving this has workID (PK), Workday, taskID, StatusID, DateLastUpdated, UpdatedByUserID. The query used for my form selects all from this table and joins in metadata tables for Task, Status and User. There are multiple records with the same workday value and the same taskID, but never the same combination of the two. The form has a few filters in the header, and the bottom section is a datasheet. In the datasheet I have a combo box used to update StatusID, all other fields are disabled and locked. My hyperlink click event is on the Workday field, and is working in that it creates the appropriate URL, it's just populated with the same taskID and workday values, eg even if I click on the row for "2016-07-12" "456", I still return "2016-07-11" & "123"
Here's a simplified version of what the data looks like. My goal is that when the user clicks on a workday, they are taken to a hyperlink made up of both the workday and TaskID of the row clicked on.
Workday TaskID
2016-07-11 123
2016-07-11 456
2016-07-11 789
2016-07-12 123
2016-07-12 456
2016-07-12 789
2016-07-13 123
2016-07-13 456
2016-07-13 789
I think I actually solved it - the problem was that since almost all fields were locked and disabled, the current record wasn't technically the row I was clicking on. I set Enabled = Yes for the Workday column, and now it's working as expected.
I am trying to create a chart using SSRS 2008. I've got 4 category fields:
field 1
field 2
field 3
field 4
I want to add another category field in the chart which will be a total, e.g.:
field 1 + field 2 + field 3 + field 4
Now I don't know how to do it. Field 1 through field 4 come from a table directly, but because field 5 is the total I dont know how to add it manually?
In the Category field of the chart, I have used group on(column name) and want to add another field in the chart which will be the total.
I have even tried this :-
=Fields!ColumnName.Value.Equals("ABC")+Fields!ColumnName.Value.Equals("DEF")+Fields!ColumnName.Value.Equals("GHI")+Fields!ColumnName.Value.Equals("JKL")
Please help!!!!
I would select the chart object, then click it again so the Chart Data pane appears.
Then I would click the + button next to Values, then choose Expression.
In the Expression I would enter something like:
= Fields!Field1.Value + Fields!Field2.Value + Fields!Field3.Value + Fields!Field4.Value
I would go back to the Dataset and add a UNION with a GROUP BY to generate a total row. I would overwrite the Field1-4 values with 'Total'.
My report look like below
Region1 Region2 Region3 Region4 Region5 state1 state2 state3 state4 state5
I have created column selection parameter and Region value 0
State value 1
How I need to make changes if I select Region only regions 1 to 5 are displayed, or if I select State only states 1 to 5 are displayed?
Can you please help me guys I have been stuck for 3 days. I tried of selecting using single column selection by using below
expression =iif(instr(Join(Parameters!ColumnSelect.Value,","),"01")>0,false,true)
But i am unable select 5 columns at a time.
I think your expression should be:
= Not(Join(Parameters!ColumnSelect.Value,",").Contains("0"))
I would be applying that as the Column Hidden Expression for the Region columns. A similar expression (with the "0" changed to "1") should work for the State columns.
Set the Hidden Condition of each column individually. Make sure you are selecting the columns under Column Groups in the Advanced Mode of the Grouping Window:
Region Columns Hidden Condition:
=Join(Parameters!ColumnSelect.Value,",") not like '*0*'
State Columns Hidden Condition:
=Join(Parameters!ColumnSelect.Value,",") not like '*1*'
I am using below expression
=IIF(instr(Join(Parameters!ColumnsSelect.value,", "),"0")=0,True,False)
=IIF(instr(Join(Parameters!ColumnsSelect.value,", "),"1")=0,True,False)
It seems I've hit a brick wall in MS Access 2010.
It's kind of hard to explain what I'm trying to achieve, so I'll start with a basic example. Let's say we have two tables: A and B.
A:
ID Price Item
1 5 ABB
2 4 ATV
3 2 CCC
B:
ID Price limit Chosen item
1 3
2 4
3 5
4 6
What I'm trying to achieve is create a Relation from table A to B. Each record in table B has to have associated table A record. It should be based on table A field 'Price' and table B field 'Price limit' in a way that the price of selected record from Table A is lower than the price limit imposed in table B record.
That is, the possible table A records for the first table B record is only CCC, for second - ATV and CCC, while for third and fourth all records are valid.
As far as my limited access knowledge goes, I've figured that I should write a query in "Chosen item" field row source property. I've tried writing it myself, however, without success. Here's what I've come up with:
SELECT [Table A].[ID], [Table A].[Item]
FROM [Table A]
WHERE [Table A].[Val] > [Val];
But it does not work. Could somebody please point me to the right direction?
I think that you want something like this where the dropdown box only contains relevant items:
You can set this up by setting the row source of the combo to say,
select item from ta where price<=forms!tb!pricelimit
And adding a little code
Private Sub Form_Current()
Me.Chosenitem.Requery
End Sub
Note that this method comes with a warning. Usong dropdowns like this on a continuous form can seriously mess up the display of your data on any rows other than the current row. In this case, the display is fine, because the bound column and the data to be displayed are the same, however, if the selection was:
Row Source: select id,item from ta where price<=forms!tb!pricelimit
Bound Column: 1
Column Widths : 0cm;2cm
Data would appear to disappear from records when the selection for the current record produced a list that did not contain IDs for other rows. That is to say, if the selection for the current rows returned IDs 1 and 2 and the next row already had ID 3 chosen, the combo for the next row would appear to empty, and so on down the page.