Solved

MS Access VBA Filter

Posted on 2012-12-27
2
365 Views
Last Modified: 2012-12-27
I have a subform which is linked on ClientID = CLientID parent to child

There is another field visitID in both parent and child (visitID)

I need a link on parent and subform where the parent visitID = child.visitID OR a NULL value.

Heres the reason...
The child table is a contacts history table and can have replicated contact's because they will on multiple visits over the years
0
Comment
Question by:lrbrister
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 38723726
You can't really link with a NULL value, at least not directly with the Master/Child linking mechanism. Note you CAN include more than one field in the Master/Child links ... to do that, click on the build button in the Master Linkfield or the Child linkfield in the subform object's Property view. You can then select multiple fields to link on.

If you mean that you need to link on both (ClientID=ClientID and VisitID=VisitID) as well as ONLY (ClientID=ClientID), then I think you'll probably have to build the recordset for that yourself and set your subform's Recordsource directly, instead of relying on the builtin link mechanism. To do that, just use the Master form's Current event  to set the subform's Recordsource, somethnig like:

Me.YourSubformOBJECT.Form.Recordsource = "SELECT * FROM SomeTable WHERE (ClientID=" & Me.ClientID & " AND VisitID=VisitID) OR (ClientID=" & Me.ClientID & ")"
0
 

Author Closing Comment

by:lrbrister
ID: 38724365
Thanks
Watch for another question
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question