Datasheet view vs Form view (1 Viewer)

TobyMace

Registered User.
Local time
Today, 11:46
Joined
Apr 13, 2018
Messages
65
Hi All,

I have a form with fields [RER] and [SN]. The record source is Table_1.

There is also a subform that has fields [RER] and [SN]. The record source is Query_1. Query_1 is a Select Query from Table_1.

subform is linked to parentform on the SN field.

I have a macro On Current event of parentform that filters subform:
[RER]<>[Forms].[Main_F].[RER] -----> (Main_F is parentform)

ID RER SN
1 800 135001
2 801 135002
3 802 135003
4 803 135001

So if the parentform is showing record ID=1 then I want the subform to show record ID=4 ONLY (in this example).

(This sound like a daft system but it's used for checking previous returns on units with that SN but we don't want to show the same record as the parentform as that's the one we're already looking at... with me? :confused:)

Now the problem... In form view it filters straight away with no issues and working as I like.
However as soon as I look in datasheet view and click the plus sign to show the subform results it shows all records where SN is equal but has not applied the filter to the RER field. If I then click on another record it will then apply the filter. I was wondering if there is a way of the filter being applied as I click the plus sign? I've tried On Current, On Load and On Got Focus events for both parentform and subform... Any ideas?

Many thanks,
 

Ranman256

Well-known member
Local time
Today, 06:46
Joined
Apr 9, 2015
Messages
4,337
you shouldn't need form and datasheet.
set the form to form view,
the subform to either( form or datasheet)
bind subform to the master form on the key field.
 

TobyMace

Registered User.
Local time
Today, 11:46
Joined
Apr 13, 2018
Messages
65
you shouldn't need form and datasheet.
set the form to form view,
the subform to either( form or datasheet)
bind subform to the master form on the key field.

Hi RanMan,

Thanks for you reply. I'm wanting the parentform to be in datasheet view for general use. I'm was saying that in form view it seemed to work.
The subform is linked to the parentform on SN field.

Many thanks.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:46
Joined
Oct 29, 2018
Messages
21,477
Hi,

Maybe you could modify Query 1 to filter out the current record, so you won’t need to use any code at all.
 

Users who are viewing this thread

Top Bottom