Solved

MS Access VBA Filter

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now