By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,122 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,122 IT Pros & Developers. It's quick & easy.

Access 2016 error message Sub Or Function not defined

P: 1
If IsLoaded("ViewActivities Form") Then DoCmd.Requery acForm, ([ViewActivities Form])
this gives me the error: Sub or Function not defined
WHY?
Jan 24 '18 #1
Share this Question
Share on Google+
1 Reply


PhilOfWalton
Expert 100+
P: 1,430
Have you defined the IsLoaded function?

The built in IsLoaded works like this
Expand|Select|Wrap|Line Numbers
  1.    CurrentProject.AllForms("ViewActivities Form").IsLoaded
  2.  
I also use this user function (before the above function existed)
Expand|Select|Wrap|Line Numbers
  1. Function IsLoaded(ByVal strFormName As String) As Integer
  2.  ' Returns True if the specified form is open in Form view or Datasheet view.
  3.  
  4.     Const conObjStateClosed = 0
  5.     Const conDesignView = 0
  6.  
  7.     If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
  8.         If Forms(strFormName).CurrentView <> conDesignView Then
  9.             IsLoaded = True
  10.         End If
  11.     End If
  12.  
  13. End Function
  14.  
Phil
Jan 25 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.