Jumat, 04 November 2011

[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

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar