D
DD
I have a mainform with a subform
Below is code i am trying to adapt (Thanks Don
1.This first part is causing me problems so i have deleted it as it strikes me that it is looking for a listbox and i have a form with a subform please correct me if i am wrong as an error appears with the VarItm
2.
The other part of the code is what i am working on, my problem is that Me.choosemonth is giving me an error 3070 does not recognise 200403 as a valid field
Where do i get this number from? qryGSTRecieved
PaidMonth: Format([paidDate],"yyyymm "
This is used in the dropdown box Me.ChooseMont
-------------------------------------------------------------------------------
Deleted thi
Dim ctl As Contro
Dim varItm As Varian
Dim strSelected As Strin
Set ctl = Me.lstTransTyp
For Each varItm In ctl.ItemsSelecte
If Len(strSelected) > 0 The
strSelected = strSelected & ", " & chr$(39)
ctl.ItemData(varItm) & chr$(39
Els
strSelected = chr$(39) & ctl.ItemData(varItm) & chr$(39
End I
Next varIt
'Debug.Print strSelecte
-------------------------------------------------------------------------------
Using thi
MySql = "" 'Clear the string variabl
'Construct the MAIN SQL statement her
MySql = MySql & "SELECT qryGSTRecieved.* FROM qryGSTRecieved
'Now test for and add the WHERE portion her
If Len(strSelected) > 0 And InStr(1, strSelected, "All") = 0 The
MySql = MySql & "WHERE (((qryGSTRecieved.PaidDate)In(
MySql = MySql & strSelecte
MySql = MySql & ")))
End I
'Again, test for and add the ORDER BY here
If Not IsNull(Me.chooseMonth) The
MySql = MySql & "ORDER BY
MySql = MySql & Me.chooseMont
End I
'Finally, "close out" the SQL string using the semi-colo
MySql = MySql & ";
'Check the resulting SQL string
'If an error is displayed, you can copy the SQL string from the debug windo
'into a new query in order to help determine why it isn't workin
'Debug.Print MySQ
'Setting the subform's Recordsource here automatically updates the display
'No need to requery the subform
Me.fsubGSTRecieved.Form.RecordSource = MySq
Set ctl = Nothin
End Su
===========================
The main form has a dropdown box "chooseMonth", in the afterupdate even
i requery the subform so all records with the same date are viewed
Now i only want to print the selected records of the selected mont
Can any one advise on the belo
Below is code i am trying to adapt (Thanks Don
1.This first part is causing me problems so i have deleted it as it strikes me that it is looking for a listbox and i have a form with a subform please correct me if i am wrong as an error appears with the VarItm
2.
The other part of the code is what i am working on, my problem is that Me.choosemonth is giving me an error 3070 does not recognise 200403 as a valid field
Where do i get this number from? qryGSTRecieved
PaidMonth: Format([paidDate],"yyyymm "
This is used in the dropdown box Me.ChooseMont
-------------------------------------------------------------------------------
Deleted thi
Dim ctl As Contro
Dim varItm As Varian
Dim strSelected As Strin
Set ctl = Me.lstTransTyp
For Each varItm In ctl.ItemsSelecte
If Len(strSelected) > 0 The
strSelected = strSelected & ", " & chr$(39)
ctl.ItemData(varItm) & chr$(39
Els
strSelected = chr$(39) & ctl.ItemData(varItm) & chr$(39
End I
Next varIt
'Debug.Print strSelecte
-------------------------------------------------------------------------------
Using thi
MySql = "" 'Clear the string variabl
'Construct the MAIN SQL statement her
MySql = MySql & "SELECT qryGSTRecieved.* FROM qryGSTRecieved
'Now test for and add the WHERE portion her
If Len(strSelected) > 0 And InStr(1, strSelected, "All") = 0 The
MySql = MySql & "WHERE (((qryGSTRecieved.PaidDate)In(
MySql = MySql & strSelecte
MySql = MySql & ")))
End I
'Again, test for and add the ORDER BY here
If Not IsNull(Me.chooseMonth) The
MySql = MySql & "ORDER BY
MySql = MySql & Me.chooseMont
End I
'Finally, "close out" the SQL string using the semi-colo
MySql = MySql & ";
'Check the resulting SQL string
'If an error is displayed, you can copy the SQL string from the debug windo
'into a new query in order to help determine why it isn't workin
'Debug.Print MySQ
'Setting the subform's Recordsource here automatically updates the display
'No need to requery the subform
Me.fsubGSTRecieved.Form.RecordSource = MySq
Set ctl = Nothin
End Su
===========================