Message for Steve Schapel

  • Thread starter Thread starter Peppie
  • Start date Start date
P

Peppie

Hi Steve,

Your help was much appreciated, but your solution lead to a new
question.

I can add new projects to my clients. I can also add new contact
persons to clients. But sometimes, the details of a contact
person change. Is it possible to select a record in the subform
and then program a button that opens an edit contact form where
the selected contactperson is already selected and ready for
edits? I do not want to allow eddits in the subform, because
this subform only shows limited information. I tried to set a
default value of ContactID field in the Edit contact form as
such: [forms]![Contacts subform]![ContactID] but that did not
work. It opens the form, but it does not show the selected
record. It always show the first record that is in the Contact
table.

Do you know how to solve this problem?

Thanks in advance, Peppie
 
Peppie,

If you are using an OpenForm action in your macrto to open the Contacts
form, use the Where Condition argument in the macro. It will look like
this...
[ContactID]=[Forms]![Clients]![Contacts subform]![ContactID]
 
Steve wrote:

Peppie,

If you are using an OpenForm action in your macrto to open the
Contacts
form, use the Where Condition argument in the macro. It will
look like
this...
[ContactID]=[Forms]![Clients]![Contacts subform]![ContactID]

Hi steve,

Thanks for your reply and it works. Allthough, when I hit the
edit-button that I created it asks me to enter the ContactID.
Unfortunately, I have added this column, but I also hid it (all
these numbers are too distracting). So isn't it possible to
automatically select the ContactID of the selected record in the
sub form when opening the edit-form?

Thanks, Peppie
 
Peppie,

It shouldn't make any difference whether the ContactID control is hidden
or not. If you are being prompted for the value, then it means there is
a mistake in the Where Condition expression, probably a spelling error.
Check the name of the main form (I have assumed "Clients"), the name
of the subform control on the main form (I have assumed "Contacts
subform"), and the name of the hidden ID control (I have assumed
"ContactID").
 
Back
Top