dbTalk Databases Forums  

unable to open record in subform while running filter

comp.databases.ms-access comp.databases.ms-access


Discuss unable to open record in subform while running filter in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Co
 
Posts: n/a

Default unable to open record in subform while running filter - 09-28-2010 , 01:36 AM






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

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: unable to open record in subform while running filter - 09-28-2010 , 10:17 AM






Co wrote:
Quote:
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).

Reply With Quote
  #3  
Old   
Co
 
Posts: n/a

Default Re: unable to open record in subform while running filter - 09-28-2010 , 11:02 AM



On 28 sep, 18:17, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
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).
That's because initially I just call the table called Tabel_Aanvragen.
This table holds personnel records.
When I want to see all the VISA application from one person I call
this JOIN:
SELECT Tabel_Aanvragen.*, VISA.* " & _
"FROM Tabel_Aanvragen RIGHT JOIN VISA ON Tabel_Aanvragen.ID =
VISA.ID"

Marco

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.