Solved

MS Access VBA Filter

Posted on 2012-12-27
2
372 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

828 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