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