Sabtu, 05 November 2011

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

John,

I am sorry I had to shut down my computer shortly after I got your answer below yesterday.
You ask in your answer below "What´s the code behind the Kontaktpersoner form", and the only thing I could think of that could affect the situation is the following piece of code that I have on the Event Property 'On Current':
….
If IsLoaded("Adressregister") Then
Me!Adressnr=Forms!Adressregister!Adressnr
End If

My intention with this code is to keep the forms Adressregister synchronized with the form Kontaktpersoner so that when I step to the next record on the form Adressregister, the form Kontaktpersoner will follow automatically showing me the relevant contact persons for the company now shown on the form Adressregister.
This works fine as long as I only keep to stepping forwards and backwards among the records in the Adressregister form. But as soon as I try to filter on the form Kontaktpersoner by choosing "Filter by form" on the top line of the screen, I run into the problem described in my note.

Hoping you can help me out of this "locked situation".

Dennis Davidsson


4 nov 2011 kl. 16:27 skrev John Viescas:

> 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
>
>

[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