![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi All, I use a form with a subform. When I set a filter to show only records from a certain date I change the source to this: strSource = "SELECT Tabel_Aanvragen.*, VISA.* " & _ "FROM Tabel_Aanvragen RIGHT JOIN VISA ON Tabel_Aanvragen.ID = VISA.ID" If Not IsNull(Me.txtStartDate) Then strWhere = strWhere & "([VISA].[datum_aanvraag] >= " & Format(Me.txtStartDate, conJetDate) & ") AND " End If If Not IsNull(Me.txtEndDate) Then 'Less than the next day. strWhere = strWhere & "([VISA].[datum_aanvraag] < " & Format(Me.txtEndDate + 1, conJetDate) & ") AND " End If Form_subFrmTabelTotaal.RecordSource = strSource Form_subFrmTabelTotaal.Filter = strWhere Form_subFrmTabelTotaal.FilterOn = True The database shows me the records correctly, but when I doubleclick to open one of the records in a seperate form it will give me an error message: 2424 The expression you entered has a field,control or property name that VisaAanvraag can't find. Why can I open a record in subform when I show all records but not when I set a filter? Regards Marco The Netherlands |
#3
| |||
| |||
|
|
Co wrote: Hi All, I use a form with a subform. When I set a filter to show only records from a certain date I change the source to this: strSource = "SELECT Tabel_Aanvragen.*, VISA.* " & _ * * "FROM Tabel_Aanvragen RIGHT JOIN VISA ON Tabel_Aanvragen.ID = VISA.ID" If Not IsNull(Me.txtStartDate) Then * * * * strWhere = strWhere & "([VISA].[datum_aanvraag] >= " & Format(Me.txtStartDate, conJetDate) & ") AND " * * End If * * If Not IsNull(Me.txtEndDate) Then * 'Less than the next day. * * * * strWhere = strWhere & "([VISA].[datum_aanvraag] < " & Format(Me.txtEndDate + 1, conJetDate) & ") AND " * * End If Form_subFrmTabelTotaal.RecordSource = strSource Form_subFrmTabelTotaal.Filter = strWhere Form_subFrmTabelTotaal.FilterOn = True The database shows me the records correctly, but when I doubleclick to open one of the records in a seperate form it will give me an error message: 2424 The expression you entered has a field,control or property name that VisaAanvraag can't find. Why can I open a record in subform when I show all records but not when I set a filter? Regards Marco The Netherlands I don't know. *Why are you resetting the subform's recordsource? * * * * strF = "[SubFormDateField] > #" & Me.SomeDate & "#" * * * * Forms!MainFormName!SubformName.Form.Filter = strF * * * * Forms!MainFormName!SubformName.Form.FilterOn = (strF > "") should be all you need (as an example). |
![]() |
| Thread Tools | |
| Display Modes | |
| |