PC Review


Reply
Thread Tools Rate Thread

Database Name

 
 
=?Utf-8?B?TmlnZWw=?=
Guest
Posts: n/a
 
      29th Aug 2005
I have 2 databases that are very similiar and I swap a specific form between
them frequently, the forms do different things based on the database they are
in.

Is there anyway I can find out the name of the database that the form is
coming from and then use an ifthenelse statement to run code

ie:
if database name = "one" then
domcd.quit
else
docmd.openform "form1"
end if


Thanks in advance


 
Reply With Quote
 
 
 
 
=?Utf-8?B?JzY5IENhbWFybw==?=
Guest
Posts: n/a
 
      29th Aug 2005
Hi, Nigel.

> Is there anyway I can find out the name of the database that the form is
> coming from and then use an ifthenelse statement to run code


If you are running Access 2000 or later, then the following code would work:

If (CurrentProject.Name = "one") Then
DoCmd.Quit
Else
DoCmd.OpenForm "Form1"
End If


HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


"Nigel" wrote:

> I have 2 databases that are very similiar and I swap a specific form between
> them frequently, the forms do different things based on the database they are
> in.
>
> Is there anyway I can find out the name of the database that the form is
> coming from and then use an ifthenelse statement to run code
>
> ie:
> if database name = "one" then
> domcd.quit
> else
> docmd.openform "form1"
> end if
>
>
> Thanks in advance
>
>

 
Reply With Quote
 
 
 
 
David C. Holley
Guest
Posts: n/a
 
      29th Aug 2005
What do you mean that you SWAP a form between them?

Nigel wrote:
> I have 2 databases that are very similiar and I swap a specific form between
> them frequently, the forms do different things based on the database they are
> in.
>
> Is there anyway I can find out the name of the database that the form is
> coming from and then use an ifthenelse statement to run code
>
> ie:
> if database name = "one" then
> domcd.quit
> else
> docmd.openform "form1"
> end if
>
>
> Thanks in advance
>
>

 
Reply With Quote
 
Larry Linson
Guest
Posts: n/a
 
      31st Aug 2005
CurrentDB().Name will give you the fully qualified path and filename of the
current MDB database.

Larry Linson
Microsoft Access MVP

"Nigel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have 2 databases that are very similiar and I swap a specific form
>between
> them frequently, the forms do different things based on the database they
> are
> in.
>
> Is there anyway I can find out the name of the database that the form is
> coming from and then use an ifthenelse statement to run code
>
> ie:
> if database name = "one" then
> domcd.quit
> else
> docmd.openform "form1"
> end if
>
>
> Thanks in advance
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: creating last name first, first name last from a column of first name last name data Rick Rothstein Microsoft Excel Programming 0 27th Jul 2009 07:25 AM
1st name last name to last name, 1st name shan Microsoft Excel Worksheet Functions 2 11th Mar 2009 07:59 PM
change first name last name to last name first name Doris smith Microsoft Excel Misc 3 25th Feb 2009 12:35 PM
how do I reveerse name order last name, first name to first name, last name Don Smith Microsoft Excel Discussion 9 29th Nov 2006 10:55 PM
Changing a list from last name, first name to first name, last name zgall1 Microsoft Excel Misc 3 17th Feb 2006 12:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:07 AM.