[mso] Access VBA Code

  • From: Herbert Chitate <hchitate@xxxxxxxxxxx>
  • To: MSO Group <mso@xxxxxxxxxxxxx>
  • Date: Sun, 10 Jan 2010 20:45:27 +0000

Hi Folks,

 

I have the following code in the activate event of a form. I basically want the 
code note to run the activate event code if the form Customer Form is not open.

 

It works on when the form Customer form is open, but when it is closed I get 
the error "Microsoft Access Can't find the form Customer Form referred to in a 
macro......" If I click end bug it opens the form ok....How can i adjust the 
below code so that I don't get this error message.

 

 


 Option Compare Database


Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
        If Forms(strFormName).CurrentView <> 0 Then
            fIsLoaded = True
        End If
    End If
End Function

 

 

Private Sub Form_Activate()
DoCmd.GoToRecord , , acNewRec
If fIsLoaded("frmCustomer_Form") = False Then
Me.Acct_No = Forms![Customer Form]![Acct No]
Me.Title = Forms![Customer Form]![Title]
Me.First_Name = Forms![Customer Form]![First Name]
Me.Last_Name = Forms![Customer Form]![Last Name]
End If

End Sub


 

Many Thanks

 

Herbert

                                          
_________________________________________________________________
Tell us your greatest, weirdest and funniest Hotmail stories
http://clk.atdmt.com/UKM/go/195013117/direct/01/
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister group. 
 This group will not allow for posting of emails, but will allow you to join 
and share problem files, templates, etc.:  
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE 
SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: