2nd dropdown is multiselect. Working fine when i'm selection only one poll when when selecting more than one poll getting error "incorrect syntax near ',' "
My data set query is
SELECT tblPS_Question.Question
,tblPS_PollSurveyMaster.PollSurveyID
,tblPS_PollSurveyMaster.PollSurveyName
FROM tblPS_Question
INNER JOIN tblPS_PollSurveyMaster ON tblPS_Question.PollSurveyID = tblPS_PollSurveyMaster.PollSurveyID
WHERE (tblPS_PollSurveyMaster.IsActive = 1)
AND (tblPS_PollSurveyMaster.PollSurveyName = #PollSurveyName)
I guess #PollSurveyName is taking only one poll name how to pass multiple name so that based on passed names Questions dropdown will get populated.
Assuming that #PollSurveyName is the name of the 1st parameter then just change your last line to
AND (tblPS_PollSurveyMaster.PollSurveyName IN(#PollSurveyName))
Related
I am currently trying to set up a GUI frontend for easier querying for colleagues.
I have tried researching and following instructions from various sources but still not able to make it work.
I have two lists.
1) This is the row source query for the first list(List0):
SELECT Test_Case_ID.Test_Case_Unique_ID, Test_Case_ID.Test_Case_Description
FROM Test_Case_ID
ORDER BY Test_Case_ID.[Test_Case_Description];
2) This is for the second list(List2):
SELECT Reference_ID.Reference
FROM Test_Case_ID INNER JOIN (Reference_ID INNER JOIN Test_Result
ON Reference_ID.Reference_Unique_ID = Test_Result.Reference_Unique_ID)
ON Test_Case_ID.Test_Case_Unique_ID = Test_Result.Test_Case_Unique_ID
WHERE (((Test_Case_ID.Test_Case_Description)=[Forms]![Form1]![List0]));
I have a an event procedure for List0:
Private Sub List0_AfterUpdate()
Forms![Form1]![List2].Requery
End Sub
However, there are no outputs on List2 even after clicking on items in List0. Can I have some advice to fix it? Thank you
Firstly, check that the bound column of your list box List0 corresponds to your Test_Case_Description field.
With the form open and populated with data, you can also run a number of tests 'manually' by creating a separate query containing the SQL for your list box row source and verifying whether or not it returns any results:
select
reference_id.reference
from
test_case_id inner join
(
reference_id inner join test_result
on reference_id.reference_unique_id = test_result.reference_unique_id
)
on test_case_id.test_case_unique_id = test_result.test_case_unique_id
where
test_case_id.test_case_description = [forms]![form1]![list0]
You can also use a query with the following SQL code to test the value returned by [forms]![form1]![list0] and ensure that it returns the value that you expect for use in your selection criteria:
select
t.test_case_description,
[forms]![form1]![list0] as listboxvalue,
t.test_case_description = [forms]![form1]![list0] as testmatch
from
test_case_id t
I have added a checkbox to the user profile and need to know how to get a list of all the user email addresses where they have checked the checkbox. I would like to just run a SQL query, but can't see where the value is stored.
All the profile data is stored in #__user_profiles table. To retrieve the data from the profile table you can perform this query
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with "checkbox.".
// Order it by the ordering field.
$query->select($db->quoteName(array('user_id', 'profile_key', 'profile_value')));
$query->from($db->quoteName('#__user_profiles'));
$query->where($db->quoteName('profile_key') . ' LIKE '. $db->quote('\'checkbox.%\''));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();
You will get object list of all those users who clicked on your checkbox. Remember to use the profile_key name in place of checkbox
Ok - I have now managed to answer my own question (I took an export of the database as a SQL file, ticked the checkbox as a test user, made another export and then compared the files to see what had changed).
The values are stored in the jos_fields_values table. The query below assumes that there is only one checkbox - if you have more than one you will need to query the field_id as well, Replace xxx with the prefix of your Joomla installation.
SELECT email FROM xxx_users INNER JOIN xxx_fields_values ON xxx_users.ID=xxx_fields_values.item_id
I have a table tblItems with a list of inventory items. The table has many columns to describe these items, including columns for SupplierName, SupplierOrderNumber and PredictedArrivalDate.
If I order several new items from a supplier, I will record each item separately in the table with the same supplier name, order number and a predicted arrival date.
I would like to add a data macro, so that if I update the PredictedArrivalDate for one record, the value will be copied to the PredictedArrivalDate column of other records/items with the same SupplierName AND SupplierOrderNumber.
The closest I've got is:
SetLocalVar (MySupplierName, [SupplierName])
SetLocalVar (MySupplierOrderNumber , [SupplierOrderNumber ])
SetLocalVar (MyPredictedArrivalDate, [PredictedArrivalDate])
For Each Record in tblItems
Where Condition = [SupplierOrderNumber] Like [MySupplierOrderNumber] And [SupplierName] Like [MySupplierName] And [PredictedArrivalDate]<>[MyPredictedArrivalDate]
Alias OtherRecords
EditRecord
SetField ([OtherRecords].[PredictedArrivalDate], [MyPredictedArrivalDate])
End EditRecord
However, when I run this, only 5 records update, and the error log reports error -20341:
"A data macro resource limit was hit. This may be caused by a data
macro recursively calling itself. The Updated() function may be
used to detect which field in a record has been updated to help
prevent recursive calls."
How can I get this working?
I'm not one for using macro's to do anything, so I'd use VBA and recordsets/an action query to do the updating.
You can call a user-defined function inside a data macro by setting a local var equal to its result.
Access doesn't like data macros triggering themselves (which you are doing, you're using an on update macro and updating fields in the same table on a different record), because there is a risk of accidentally creating endless loops. Looks like you triggered a measure that's made to prevent this. I'd try to avoid that as much as possible.
Note: using user-defined functions inside data macros can cause problems when you're linking to the table from outside of Access (via ODBC for example).
This isn't a good solution (it's not a data macro), but it does work as a temporary fix.
I created an update query called "updatePredictedArrivalDate":
PARAMETERS
ItemID Long,
MyPredictedArrivalDate DateTime,
MySupplierName Text ( 255 ),
MySupplierOrderNumber Text ( 255 );
UPDATE tblItems
SET tblItems.PredictedArrivalDate = [MyPredictedArrivalDate]
WHERE (((tblItems.SupplierName) = [MySupplierName])
AND ((tblItems.SupplierOrderNumber) = [MySupplierOrderNumber])
AND ((tblItems.ID) <> [ItemID]));
On the PredictedArrivalDate form field .AfterUpdate event, I then added this macro:
IF [PredictedArrivalDate].[OldValue]<>[PredictedArrivalDate] Or [PredictedArrivalDate]<>""
OpenQuery (updatePredictedArrivalDate, Datasheet, Edit, [ID], [PredictedArrivalDate], [SupplierName], [SupplierOrderNumber])
I now have to remember to add this .AfterUpdate event to any other forms I create that amend that particular field.
If anyone has a better solution, please let me know.
I have a table based on three drop down lists. The first is a client list, the second is a date list and the third is a stage list. The first two are single value lists. I can only allow the user to select 1 from each of those lists. The third list is a stage list. This contains the values First,Final and Release. My client has come back to me and asked if I can supply them with the ability to select all of the stages as an option. Here is the query as I have it right now. I have tried using (AnnotationDate IN (#Stage)) in place of (AnnotationDate = #Stage) but was unsuccessful. Can anyone give me a helpful hint?
SELECT AdDate, Page_ID, Status, AnnotationNumber, AnnotationBy, [Role Description], AnnotationDate, AnnotationType, BusinessUnit, ActualAgencyError, ErrorType,
AnnotationComments, TeamComments, sgkComments, PA, Client, Activity, Support, Name, BusImpact
FROM vwAgencyErrorOpen
WHERE (Client = #Client) AND (AdDate = #Job) AND (AnnotationDate = #Stage)
ORDER BY Page_ID
Change your #Stage Parameter to be multi-seletion.
Then remove the (AnnotationDate = #Stage) clause from the query.
And then set up a filter on your dataset as below:
You can then select all of your options.
I have connected to one MySql table to fetch 1000 records that need to be displayed using JSP. I want to split my table into multiple tables (of size 50) which can be viewed by using next button on jsp page. How can I implement it?
String sql = "select * from people";
PreparedStatement statement = connection.prepareStatement(sql);
ResultSet result = statement.executeQuery();
while(result.next()) { // here i get 1000 records. how can i display these records on mulitple jsp pages?
// ... get column values from this record
}
Above gives 1000 records and I use a PreparedStatement.
Assuming you can fetch the complete table in JSP.
Just add one more param to the function returning the ROWS COUNTER
Add COUNTER to LIMIT clause in your QUERY.
Now you need to keep track of the COUNTER so Update the URL on click on next as
First Click - URL?pageCOUNTER=1
Second Click - URL?pageCOUNTER=2
Fetch the pageCOUNTER varaible from URL and pass it to your function as COUNTER
And so on. Keep getting you result.
OR USE JAVASCRIPT TABLE - http://www.datatables.net/