[AccessD] Represent Hierarchical Data On A Form

Mcgillivray, Donald [CC] donald.a.Mcgillivray at mail.sprint.com
Mon Apr 28 13:07:15 CDT 2003


Using Access97 on Windows 2000.

I have three tables from which I want to display related data on a
single form.  

The tables are hierarchically related: 

tblProjects is the uppermost parent
tblPhases contains child records related to specific records in
tblProjects
tblMilestones contains child records related to specific records in
tblPhases

My approach so far has been to create an unbound main form with three
combo boxes - one for each table in the hierarchy, returning the table's
primary key - and then to embed a single-form subform for each table in
a tab control.  The idea is that the user will select the project from
cboProjects, cboPhases will re-populate according to the selection, the
user can then select a phase from cboPhases, and cboMilestones will
re-populate according to that selection, and the subforms will be
synchronized with the values chosen in the combos.  

Seems simple, and it works well enough when simply displaying data.
However, I also want to allow new records to be added to any of the
three subforms.  Here's where I run into trouble.  When I attempt to add
a new record to a table via the subform, I get an error: "You tried to
assign the Null value to a variable that is not a Variant data type."  I
have minimal experience with bound subforms in an unbound main form, but
I suspect that the error is related to something internal to Access as
it attempts to synchronize the subs with the parent form.  I say this
because no code of mine is executing at the time the error occurs, and I
have found no means of capturing the error.  The maddening thing is
that, when I clear the message box, the record is added as expected with
no errors.

I'm hoping that somebody knows where this error is happening so that I
may trap it and bypass the message box.  Failing that, perhaps there's a
more effective way to accomplish what I'm trying to do.  Either way (or
maybe both ways!) I welcome any advice, suggestions, comments, or
further questions.

Thanks!

Don McGillivray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030428/f4da6d41/attachment.html>


More information about the AccessD mailing list