Opening new form in add mode with preset values

  • Thread starter Thread starter Bob Quintal
  • Start date Start date
B

Bob Quintal

(e-mail address removed) wrote in
I'm currently working on a personal database to manage family-tree
type data and have come across a problem.

To note off the bat, I'm very new to Access and am essentially
teaching myself as I go by picking apart template databases and
playing with my own "test" databases. I only yesterday figured out
that most of my hitches now require macros or visual basic coding
so I've been trying to learn that too. I figured out how to have a
new form open to a related record, and how to have a new form open
in add mode, but I'm not sure how to have it open a new form in
add mode and automatically fill in a value based on the form it
was opened from. More specifically, I have a "Family Unit" form
that shows mother, father, and children (as subform) and want a
user to be able to add a new child and have the "Unit_Id" value
for that new FamilyMember to automatically be filled in to match
the Unit_Id from the active Family Unit.

I've looked around on various templates for a similar situation
with coding that I could take and adapt, but so far with no luck.
I feel like this should be coding as simple as the "open form to
related record" situation....is it and could you let me know the
solution? Or should I sit down and read all those dense chapters
that explain macros and visual basic first?

Thanks a lot,
Ribs
If you have a subform embedded in a form, and the link child fields
and link parent fields are properly set, in your case to the Unit_ID
in both parent and child, this should be populated automatically in
the subform when you add a new record to the subform.
 
I'm currently working on a personal database to manage family-tree
type data and have come across a problem.

To note off the bat, I'm very new to Access and am essentially
teaching myself as I go by picking apart template databases and
playing with my own "test" databases. I only yesterday figured out
that most of my hitches now require macros or visual basic coding so
I've been trying to learn that too. I figured out how to have a new
form open to a related record, and how to have a new form open in add
mode, but I'm not sure how to have it open a new form in add mode and
automatically fill in a value based on the form it was opened from.
More specifically, I have a "Family Unit" form that shows mother,
father, and children (as subform) and want a user to be able to add a
new child and have the "Unit_Id" value for that new FamilyMember to
automatically be filled in to match the Unit_Id from the active Family
Unit.

I've looked around on various templates for a similar situation with
coding that I could take and adapt, but so far with no luck. I feel
like this should be coding as simple as the "open form to related
record" situation....is it and could you let me know the solution? Or
should I sit down and read all those dense chapters that explain
macros and visual basic first?

Thanks a lot,
Ribs
 
If we were talking Excel or Word, "macro" and VBA mean the same thing.
Not so in Access.

In Access, a Macro is a thing of a very different stripe vroom VBA.
An Access Macro is presented in its own tabular format (mostly) into
which you can enter some things and select others. For an Access
novice they can seem as sweet as candy. However the more you attempt
to move into advanced functionality away from the main stream the more
constraining macros become. There is a further and much worse knock
on Macros: they are awkward and all but impossible to debug. When
things go wrong the person doing the debugging is faced with a lot of
modifying of the macro to try to identify where the error arises and
then try to play with things to actually identify the problem and do
something about it. Many of us started by using Macros in days of
yore because that was what the MS Press books on Access touted. Oh
the pain! If you plan to ever develop Access applications beyond the
most trivial, don't bother learning Access macros.

VBA is BASIC updated and extended to handle the object models of all
of the MSOffice platforms and Visual BASIC itself. Also, several
other vendors have licensed VBA for their own platforms. If you're
going to develop Access applications, spend your time and efforts
learning VBA along with Access.

To get some specific recommendations on books and tutorials, google
these Access newsgroups on combinations of VBA and books and tutorials
and you'll get a pretty good list.

I always recommend to newbies that they lurk

microsoft.public.access.gettingstarted
microsoft.public.access..tablesdesign

and www.mvps.org/access A lot of what's there won't make sense
right of way but it's a good idea to go there and look around. Absorb
what you can now and you'll know that the rest is there when you need
it.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top