Tech Support banner

Status
Not open for further replies.
1 - 3 of 3 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter #1
I've got a form with an option group (ShiftSelect) on it with the following selections: "1", "2", "3", and "All." I am using a VB function (see below) to send the option group state to a query. In the "Shift" column of my query (criteria row) I have CalcShift(). The query works fine for "1", "2", or "3", but returns nothing for "All." I thought that an "*" was supposed to return all elements in a table...

Function CalcShift()
Dim varShift As String

Select Case (Forms!NDT!ShiftSelect)

Case Is = 1
varShift = "1"
Case Is = 2
varShift = "2"
Case Is = 3
varShift = "3"
Case Else
varShift = "*"
End Select

CalcShift = varShift
End Function
 

·
ID10T Circuit replacement
Joined
·
1,038 Posts
Could you post your sql statement?

I might be better able to help you after seeing it.

Thanks
 

·
ID10T Circuit replacement
Joined
·
1,038 Posts
Well after looking at your function and using my fried brain, and you haven't posted...

Select (* for all fields or fieldname,fieldname2,etc) FROM (table name) WHERE (field Name) = CalcShift

Set your query to not include the WHERE statement if it = *. This will return all records in the table.

The select * (you don't have to use *, but this is all the fields you want displayed.) will get all of the fields from your table, you just want to not be selective if ALL is selected. Use an if statement in your query builder.

Hope this helps.
 
1 - 3 of 3 Posts
Status
Not open for further replies.
Top