By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,480 Members | 1,606 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,480 IT Pros & Developers. It's quick & easy.

Making a query based on radio button selections

P: 56
I would like to make a form that creates a query.

I know that I could make a query for each radio button instance but that would take forever!

So basically what i have is 10 Fields in a query But the user may only need say 5 of them. Is there a way to "select/unselect" the "visible" check box in the query based on the radio buttons selected on the form?

sql for query is as follows:

<SELECT GenericRepList.[RepID#], vewEmployeeDetailInfoAll.PersonFName & " " & vewEmployeeDetailInfoAll.PersonLName AS RepName, vewEmployeeDetailInfoAll.PrimaryAddress1, vewEmployeeDetailInfoAll.PrimaryAddress2, vewEmployeeDetailInfoAll.PrimaryCity, vewEmployeeDetailInfoAll.PrimaryState, vewEmployeeDetailInfoAll.PrimaryZip, vewEmployeeDetailInfoAll.PhoneNumber, vewEmployeeDetailInfoAll.Email, vewEmployeeDetailInfoAll.ShirtSizeDescription
FROM GenericRepList LEFT JOIN vewEmployeeDetailInfoAll ON GenericRepList.[RepID#] = vewEmployeeDetailInfoAll.PersonID
GROUP BY GenericRepList.[RepID#], vewEmployeeDetailInfoAll.PersonFName & " " & vewEmployeeDetailInfoAll.PersonLName, vewEmployeeDetailInfoAll.PrimaryAddress1, vewEmployeeDetailInfoAll.PrimaryAddress2, vewEmployeeDetailInfoAll.PrimaryCity, vewEmployeeDetailInfoAll.PrimaryState, vewEmployeeDetailInfoAll.PrimaryZip, vewEmployeeDetailInfoAll.PhoneNumber, vewEmployeeDetailInfoAll.Email, vewEmployeeDetailInfoAll.ShirtSizeDescription
ORDER BY GenericRepList.[RepID#];>

Any help would be greatly appreciated.
Jan 25 '08 #1
Share this Question
Share on Google+
2 Replies


P: 32
Bold section is simmilar to what you are looking like Fairly sure with pure SQL you do not need the Parentheses I took this from an Access Query in sql view mode. My radial is called
[Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType]
it has 4 Values. It is linked to a subform.

[code]SELECT dbo_tblGiftCards.*, tblTourn.TName, dbo_tblGiftEvent.fldGiftAmount
FROM (dbo_tblGiftCards LEFT JOIN tblTourn ON dbo_tblGiftCards.fldTourID = tblTourn.TournID) LEFT JOIN dbo_tblGiftEvent ON (dbo_tblGiftCards.fldTourID = dbo_tblGiftEvent.fldTournID) AND (dbo_tblGiftCards.fldCustID = dbo_tblGiftEvent.fldCustID)
WHERE ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=1) AND ((dbo_tblGiftCards.fldTourID)=[Forms]![frmSwipeEntry]![EventID])) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=2) AND ((dbo_tblGiftCards.fldTourID) Is Null) AND ((dbo_tblGiftCards.fldIssuedOn) Is Null)) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=3) AND (Not (dbo_tblGiftCards.fldIssuedOn) Is Null)) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=4)) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=0 Or ([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType]) Is Null));[/CODE]

I would like to make a form that creates a query.

I know that I could make a query for each radio button instance but that would take forever!

So basically what i have is 10 Fields in a query But the user may only need say 5 of them. Is there a way to "select/unselect" the "visible" check box in the query based on the radio buttons selected on the form?

sql for query is as follows:

<SELECT GenericRepList.[RepID#], vewEmployeeDetailInfoAll.PersonFName & " " & vewEmployeeDetailInfoAll.PersonLName AS RepName, vewEmployeeDetailInfoAll.PrimaryAddress1, vewEmployeeDetailInfoAll.PrimaryAddress2, vewEmployeeDetailInfoAll.PrimaryCity, vewEmployeeDetailInfoAll.PrimaryState, vewEmployeeDetailInfoAll.PrimaryZip, vewEmployeeDetailInfoAll.PhoneNumber, vewEmployeeDetailInfoAll.Email, vewEmployeeDetailInfoAll.ShirtSizeDescription
FROM GenericRepList LEFT JOIN vewEmployeeDetailInfoAll ON GenericRepList.[RepID#] = vewEmployeeDetailInfoAll.PersonID
GROUP BY GenericRepList.[RepID#], vewEmployeeDetailInfoAll.PersonFName & " " & vewEmployeeDetailInfoAll.PersonLName, vewEmployeeDetailInfoAll.PrimaryAddress1, vewEmployeeDetailInfoAll.PrimaryAddress2, vewEmployeeDetailInfoAll.PrimaryCity, vewEmployeeDetailInfoAll.PrimaryState, vewEmployeeDetailInfoAll.PrimaryZip, vewEmployeeDetailInfoAll.PhoneNumber, vewEmployeeDetailInfoAll.Email, vewEmployeeDetailInfoAll.ShirtSizeDescription
ORDER BY GenericRepList.[RepID#];>

Any help would be greatly appreciated.
Jan 25 '08 #2

P: 56
Thanks! I will give it a shot!




Bold section is simmilar to what you are looking like Fairly sure with pure SQL you do not need the Parentheses I took this from an Access Query in sql view mode. My radial is called
[Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType]
it has 4 Values. It is linked to a subform.

[code]SELECT dbo_tblGiftCards.*, tblTourn.TName, dbo_tblGiftEvent.fldGiftAmount
FROM (dbo_tblGiftCards LEFT JOIN tblTourn ON dbo_tblGiftCards.fldTourID = tblTourn.TournID) LEFT JOIN dbo_tblGiftEvent ON (dbo_tblGiftCards.fldTourID = dbo_tblGiftEvent.fldTournID) AND (dbo_tblGiftCards.fldCustID = dbo_tblGiftEvent.fldCustID)
WHERE ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=1) AND ((dbo_tblGiftCards.fldTourID)=[Forms]![frmSwipeEntry]![EventID])) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=2) AND ((dbo_tblGiftCards.fldTourID) Is Null) AND ((dbo_tblGiftCards.fldIssuedOn) Is Null)) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=3) AND (Not (dbo_tblGiftCards.fldIssuedOn) Is Null)) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=4)) OR ((([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType])=0 Or ([Forms]![frmSwipeEntry]![fsubGiftCardListing].[Form]![togIssueType]) Is Null));[/CODE]
Jan 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.