Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2006, 12:50 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default closing froms in while accesing other

Hi all:),

     such a long time iam searching answer ! but iam not an aladin and also not having the magic lamp...ok let me to the point.. usual we creat the frotend in ms access by an switchboard..i did like that!.and also by some froms.What that blasting problems when i opeing the DB the switch board appears then iam selecting the option in the switchboard while iam selecting the option the selected froms are opening ...but the switchboard windows is still appearing in the desktop ..let me explain:

Iam having an DB with an SB contains --->MainFrom , --->ReportFrom ,---->Exitdatabade.
  I want is when iam open the mainform then the SB should and when i cosle the Mainfrom the switchboarb should appear..

  did u understand..

 pls help me in this issue..

bye,
pap
 
Old May 10th, 2006, 06:00 AM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I understand what you saying is that you want the form you are working on closes when you press an action button the open another form...

If this is correct, then what you have to do is create the action button to open the form you want (like opening the sb when you are working on the main form) and you should change the VBA of this action button by adding the line docmd.close at the beginning of the VBA.

This would give you something like this:

Private Sub van_codes_tt_naar_alarmen_Click()
On Error GoTo Err_van_codes_tt_naar_alarmen_Click


    DoCmd.Close
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frm opv alarmen"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_van_codes_tt_naar_alarmen_Click:
    Exit Sub

Err_van_codes_tt_naar_alarmen_Click:
    MsgBox Err.Description
    Resume Exit_van_codes_tt_naar_alarmen_Click

End Sub

You will have to do this on every action button you create.

 
Old May 11th, 2006, 01:58 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hi,
 Thanks but i think ur not in my concept , what i require is when in open the Database the SB will appear and when i select any of the action button in the SB the desire from should and the SB should close . This should revers like after updation when i close the from the SB should appear ...

 Pls give me an clarification...

thanks
&
Bye
pap
 
Old May 11th, 2006, 05:12 AM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The first thing you should do is make the SB form as the default form to open when you start the database. What you should do is open the menu Tools-->Startup. In 'Display Form/Page' you should enter the name of your SB-form (if you want you can enter an application title too, but this is not required). Accept the change by pressing enter.

Now when you open your database the form you entered here will open automatically. From this form you can navigate using the action buttons you created. I guess you know how to create the action buttons... To make sure your SB-from closes when you press the action button to open another form, you have the make a little change to the VBA of this action button. This is how you should do this:
go to design view --> right click on the action button --> properties --> select the event tab --> where you have 'on click' there will be written [Event Procedure], select this line and press the '...' at the end of the line --> a new window will open, your VBA procedure of this button is the one on which the selector is located. It will look something like this:

private sub ABC_click()
on error goto err_ABC_click

   docmd.close
   dim stdocname as string
   dim stlinkcriteria as string

   stdocname = "name of the form you want to open"
   docmd.openform stdocname, , , stlinkcriteria

exit_ABC_click:
   exit sub

err_ABC_click:
   msgbox err.description
   resume exit_ABC_click

end sub

I have used ABC because I don't know what name you gave to your action button, so it won't be ABC in your database, but the name you gave to this button. The docmd.close command will not be in your code, but you have to add it. This will make the current form (the SB-form for exemple) to close. (it makes the form on which the action button is located to close to be more exact) The rest of the code makes your other form to open. Then you just save the change in your code and exit this window. You will have to repeat this with every button you made, so if you have 20 buttons to navigate between your forms and you want them to close every time, you have to add the docmd.close on every one of these 20 buttons...

Is it this you are looking for, or do I not understand exactly what you want?

 
Old May 11th, 2006, 05:38 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

He,
   I got it sorry for irriteting u . First a fall i not able but got it now


thanks,
&
bye,
pap





Similar Threads
Thread Thread Starter Forum Replies Last Post
accesing database from server navneet_upr02 C# 2 January 3rd, 2008 08:12 AM
froms through tab controls anukagni Access 1 October 3rd, 2006 06:39 AM
Accesing COM+ components from c# txerra General .NET 2 June 24th, 2005 05:23 AM
Accesing Com+ components from c# txerra C# 1 June 22nd, 2005 06:10 AM
problem in showing froms by using names in VB.Net arctica82 Pro VB.NET 2002/2003 1 April 15th, 2005 03:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.