I do have a query that I get what I want from it. but I want to set a test field on a form the value I get from the query. Once I type the following on the control source:
=[TheQuery]![College_Name]
and once I turn the view to the form view I get this in the textfield:
#Name?
Knowing that once I run the query direct I get the right result but I'm not sure to populate a text field with the query result
you could try
=Dlookup("College_Name", "TheQueryName")
search for Dlookup and you can learn more about how to use it.
Related
I have a query that get a value from a query field. once I open the form and choose the value and I open the query it does open with no problem. I want to put a button in the same form that will allow me to open the query. Once I put the button and use the button wizard to make it open the query I get this issue once I press on the button:
The query:
SELECT Courses.Course_Id AS رقم_الدورة, Courses.Course_Name AS اسم_الدورة,
Courses.Date_Course AS تاريخ_الدورة
FROM Courses INNER JOIN Colleges ON Courses.college_Id = Colleges.college_Id
WHERE Forms![FormName]![colleges].Value=Colleges.college_Name;
Note once I open the form and open the query I get no result. but once I close the form and open the query, the query will ask me to type in the input manually and once I type in the input manually I get the right result. But once I open the the form it wont ask to input because it should take the value from the combobox colleges and it do but I think it takes something wrong knowing that the combobox contain text.
The issue I had is that the comboBox by default contain of 2 columns 0 and 1 and in the query by it self it is not possible to specify the column as I tried to specifying the column using or ![Column(1)] or even .Column(1) but none of them work and I search more this features is no more allowed since access 2013 in the query which means I should use VB to resolve it but as I continue to search I was able to do it by using a textbox so I created a textbox that read the information from the combobox and as I did that I was able to read the information from the textbox in my query
I am filtering a form named sfrWorklistFilter from a combo box named cboOpeningType. The recordsource is from an embedded query on the form. If I make a selection from the combo box the filter works fine with the following code:
Forms![sfrWorklistFilter]![cboOpeningType]
However I need to return all records when no selection is made in which case I use the following code:
Like Forms![sfrWorklistFilter]![cboOpeningType] & "*"
The filter then does not give exact matches, but all records that begin with the letter on the combo box.
I need exact matches for the record or if no selection is made all records.
Any suggestions?
EDIT remove double quotes
This should work - and you can do same thing with your other field/combobox searches
Like IIf([Forms]![sfrWorklistFilter]![cboOpeningType]<>"",[Forms]![sfrWorklistFilter]![cboOpeningType],"*")
Goal:
Display the text "All State-Province" instead of "All geographies" at the prompt list in SSRS
Problem:
I tried googling around and in the end I don't know how to solve it.
Information:
*Im using SQL server 2012
I don't use Report Server 2012, but in 2008 the following applies.
It depends on how you're populating your parameter,
If you're declaring the values in a list
Right click on the parameter, and change the label text.
or.....
If you're populating from a query then you need to ensure that the value you're using to populate the label returns "All State-Province" instead of "All geographies".
One way round this would be to set up a calculated field on the query used to populate the dataset
something like
=iif(Fields!LabelText.Value="All geographies","All State-Province",Fields!LabelText.Value)
Then use that field as the label.
I see your update..
What I believe you need to do, is set up a new calculated field on your GeographyStateProvince dataset
Call it NewLabelText.
Then use the expression
=iif(Trim(Ucase(Fields!ParameterCaptionIndented.Value))="ALL GEOGRAPHIES","All State-Province",Fields!ParameterCaptionIndented.Value)
Then as shown in my previous screen print, use the new calculated field instead of ParameterCaptionIndented
You can see your datasets on the left of this picture.
I have a query that returns a fluid # of records, depending on criteria selected in the form. I would like to display the total # of records returned to the form.
I have added a unbound text field to the footer in the form that is displaying the controls and resulting records. I tried the following expressions in the text field, both of which result in #error:
=Count([qrnname]![fieldtocount])
=DCount([qrnname]![fieldtocount])
This should be simple.
DCount requires string values for its arguments. Assuming fieldtocount is the name of a field returned by the named query qrnname, use this as your text box's Control Source ...
=DCount("[fieldtocount]", "qrnname")
Since that query depends on criteria selected in the form, Requery the text box whenever those criteria change to update the count displayed in the text box.
use this =DCount([fieldtocount]![qrnname])
The syntax for the DCount function is:
DCount ( expression, domain, [criteria] )
expression is the field that you use to count the number of records.
domain is the set of records. This can be a table or a query name.
criteria is optional. It is the WHERE clause to apply to the domain.
Dcount in detail
An other alternative is to use =Count(primaryKey) in the Control Source property
It seems better if you have some filter on your original query, so you don't have to apply them again in the DCount (expression, domain, [criteria]) function.
A quick method for counting Access records in a form
Using Access 2007, I created a form (f_login) and a query (c_login), and I want to get the result from my sql query and display on my form, via text box..
Here is my sql query (working) :
SELECT t_lvl.nr_lvl
FROM t_admin INNER JOIN t_lvl ON t_admin.nr_rf = t_lvl.nr_rf
WHERE (((t_admin.nr_rf)=[Forms]![f_login]![txb_user].[VALUE]) AND ((t_admin.psw)=[Forms]![f_login]![txb_psw].[VALUE]));
And I tried to put on my control source of my text box those codes, but none of them worked...
=DLookup("[nr_lvl]","[c_login]")
=DLookup("nr_lvl","c_login")
=DLookup("c_login","nr_lvl")
=DLookUp("[c_login]";"[nr_lvl] =" & [Forms]![f_login]![txb_lvl])
I really don't know why it doesn't work!
Test your DLookup expression in the Immediate window (you can go there with Ctrl+g).
See what you get after typing this in the Immediate window and pressing Return.
Debug.Print TypeName(DLookup("nr_lvl","c_login")), DLookup("nr_lvl","c_login")
You told us c_login is a query, showed us the SQL for that query, and confirmed the query returns the correct result. Since nr_lvl is a field returned from that query, I don't see why the DLookup would fail when the form, f_login, is open in Form View.
So see what happens with that DLookup in the Immediate window ... whether it returns no value, the wrong value, or an error message. Then you'll need to figure out how to change it to get the correct result.
OTOH, if DLookup gives you the correct result in the Immediate window, and the issue with the form is that the text box value doesn't update in response to changes in txb_user and/or txb_psw you should requery the third text box (the one which uses DLookup as its control source) from the after update events of those first two.