Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Small problem!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
smael smael - 28 Apr 2005 10:53 GMT
I have a form called Annonce_final_modif, and I want it to open up to a
Phone Number that is entered by the user.  I have an another form called
Annonce_final in which the user
would type in the Phone Number and it will open up Annonce_final_modif to
that Phone Number.  It
doesn’t work perfectly fine, because my problem is that when the user opens
the Annonce_final_modif forms, it removes phone number and It jumps to the
first record. I would instead want it to
continue from the record it is on.

I use the function ‘DoCmd.GoToRecord’

For example: The user enters in ‘0326091245’  in the Annonce_final form and
presses the open button which opens the Annonce_final_modif form on the
phone number ‘0326091245”.  When the user opens the form, it goes to first
record.
Maybe the method that I am using is wrong, if anyone has any suggestions
let me know.
Dennis - 28 Apr 2005 11:47 GMT
Try this code on the After Update event of the Phone Number field on the
Annonce_final form

Application.Echo False
DoCmd.OpenForm "Annonce_final_modif"
DoCmd.FindRecord Forms!Annonce_final!TelNo, acEntire, , acSearchAll, ,
acAll, True
DoCmd.Close acForm, "Annonce_final", acSaveNo
Application.Echo True

> I have a form called Annonce_final_modif, and I want it to open up to a
> Phone Number that is entered by the user.  I have an another form called
[quoted text clipped - 14 lines]
> Maybe the method that I am using is wrong, if anyone has any suggestions
> let me know.
smael smael - 28 Apr 2005 13:17 GMT
Hello Dennis,

I'm vey sorry but this code doesn't work. Indeed, when  the
Annonce_final_modif form opens, it jumps to the first record.

Thanks you.
Dennis - 28 Apr 2005 13:52 GMT
I copied and pasted this code out of one of my databases where it is working
fine.
The form I am opening is based on a table as its record source and the
Docmd.FindRecord will go to the the correct record for any field in the
underlying recordsource. The application.echo statements are there to stop it
briefly displaying record 1 before jumping to the correct record.

> Hello Dennis,
>
> I'm vey sorry but this code doesn't work. Indeed, when  the
> Annonce_final_modif form opens, it jumps to the first record.
>
> Thanks you.
smael smael - 28 Apr 2005 14:03 GMT
Ok Dennis,
I will try again!
Thanks you.
smael smael - 28 Apr 2005 15:30 GMT
Hello Dennis,
Your code works fine, but now I have add a control. Indeed, if the phone
number exists, I display a MsgBox, who says “The phone number also exists”.
And if it exists, the user goes to the Annonce_final_modif form. With the
new control, the code that you give me doesn’t work. Although I have try
everything, and I find nothing.
If you have a suggestion, let me know.

Here is my code :

Private Sub téléphone_AfterUpdate()

   If (DCount("*", "requete_telephone")) > 0 Then

       MsgBox ("Le numéro de téléphone que vous avez saisi existe déjà!")
 
       Application.Echo False
       DoCmd.OpenForm "TEST2"
       DoCmd.FindRecord Forms!TEST1!téléphone, acEntire, ,  acSearchAll, ,
acAll, True
       DoCmd.Close acForm, "TEST1", acSaveNo
       Application.Echo True

   End If
   
End Sub
**********************************
And here the code of my query (requete_telephone):

SELECT DISTINCT Annonce.téléphone
FROM Annonce
WHERE (((Annonce.téléphone)=[forms]![Annonce_final]![telephone]));

Thanks you!
smael smael - 28 Apr 2005 17:06 GMT
thanks you for all Denis!!!

It works perfectly fine!

Bye! :)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.