Ben_Entrew
Registered User.
- Local time
- Today, 02:48
- Joined
- Dec 3, 2013
- Messages
- 177
Hi all,
I got the following issue:
There's a table containing all sales quantities for each month, looks like:
RepMonth Quantity
012013 55
022013 4654
...
112013 4645
122013 778
Now the User should decide how many months he wants to see.
Therefore I tried this:
Actuals is the month the User defines :
Can I use this somehow in an SQL statement?
Instead of Select RepMonth,Quantity FROM TABLE_TEST
WHERE RepMonth IN ('012013','022013','032013')
I want to keep this Where statement variable.
Thanks in advance.
Regards,
Ben
I got the following issue:
There's a table containing all sales quantities for each month, looks like:
RepMonth Quantity
012013 55
022013 4654
...
112013 4645
122013 778
Now the User should decide how many months he wants to see.
Therefore I tried this:
Actuals is the month the User defines :
Code:
Public Sub TEST()
Dim Feld1() As Integer
Dim x As Integer
Dim I As Integer
Dim t As String
'x = actuals - 1
ReDim Feld1(actuals)
For I = 1 To actuals
Feld1(I) = I
t = Feld1(I) & year
If Len(t) = 5 Then
t = 0 & t
Else
End If
Debug.Print t
Next I
End Sub
Can I use this somehow in an SQL statement?
Instead of Select RepMonth,Quantity FROM TABLE_TEST
WHERE RepMonth IN ('012013','022013','032013')
I want to keep this Where statement variable.
Thanks in advance.
Regards,
Ben