Jumat, 04 November 2011

RE: [MS_AccessPros] Strange behavior when filtering on second form

 

Dennis-

If the Kontaktpersoner form is filtered to list only the contacts for the
current company, I wouldn't think that applying a filter/sort would find a
person NOT associated with that company. Perhaps the "advanced filter/sort" is
removing your original filter to allow you to search all contacts. But then
there must be something set in your form to cause the person found to have his
or her associated company ID changed. What's the code behind the
Kontaktpersoner form?

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Dennis Davidsson
Sent: Friday, November 04, 2011 3:32 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Strange behavior when filtering on second form

Hello,

I have a form called Adressregister which I use to register and maintain misc
address information in my customer table.
On this form I also have a button, on which I click to open a second form called
Kontaktpersoner which I use to register and maintain misc information about
contact persons on the current customer company.
The relation between the customer table and the contact person table is
one-to-many, i.e. each customer company can have one or more contact persons.
When I click the button to open the contact person form the following piece of
code is executed:
..
stDocname = "Kontaktpersoner"
stLinkCriteria = "[Adressnr] = " & Forms![Adressregister]![Adressnr]
DoCmd.OpenForm stDocname, , , stLinkCriteria
.

Adressnr is the primary key of the table Adressregister and a secondary key in
the table Kontaktpersoner.
All this works fine. I also have code that makes it possible to click on next
record in the Adressregister form and the form Kontaktpersoner is automatically
following so that I then get presented the contact persons for the new record in
Adressregister.

Now however comes my problem: I know the name of a certain contact person and I
want to find in which company he is the contact person. So I choose on the top
line of the Access workspace the option "Advanced to filter on form" having made
the form Kontaktpersoner the active one. I then fill in a name of the contact
person I am looking for and click "Filter on". I get the wanted information on
the contact person ok, but the strange thing is that this new person is now
automatically added to the original company that was active in the form
Adressregister!
What shall I do to avoid this unwanted action from Access?

Regards
Dennis Davidsson

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar