Is app in design mode?

  • Thread starter Thread starter CyberDwarf
  • Start date Start date
C

CyberDwarf

Hi y'all

I need to check if an app is in design mode, so that I can conditionally
switch off several "features" ;-)

As a relative newbie to Access, I would greatly appreciate any help in
locating the required code.

TIA
Steve
 
Applications don't have a design mode, Steve. Individual objects have design
views. For example, the following code will return True if the specified
form is open in design view ...

Public Function IsFormInDesignView(ByVal FormName As String) As Boolean

If CurrentProject.AllForms(FormName).IsLoaded Then
If Forms(FormName).CurrentView = 0 Then
IsFormInDesignView = True
End If
End If

End Function
 
Hi Brendan
Applications don't have a design mode.

Sorry, pls excuse my ignorance. I am working on an ADP.

Perhaps I need a way of trapping if the user is working with the ADP, or the
ADE version?

TIA

Steve
 
An MDE has a property you can check (there's an example at the URL below). I
would expect that an ADE probably has a similar property, but I have not
done much work with ADPs, and none of it recent, so I can't say for sure. If
you can't find it, try asking the question in the
microsoft.public.access.adp.sqlserver group. There are people answering
questions in that group who know a lot more about ADPs than I do.

Here's that MDE example ...

http://advisorforums.com/doc/08826
 
For anyone interested, I used the following hack:-

If Ucase(Right(CurrentProject.Name, 4)) = ".ADP" Then.....

FYI

Steve
 
It appears that an ADE has a 'MDE' property which is a member of the
CurrentProject.Properties collection. Here's the code I used to test ...

Private Sub Form_Load()

Dim aop As AccessObjectProperty
For Each aop In CurrentProject.Properties
Me.txtProps = Me.txtProps & aop.Name & ": " & aop.Value & vbCrLf
Next aop

End Sub

After I converted the ADP to an ADE, the list included a property named
'MDE' with a value of 'T', just as in an MDE.

So you could do something like this ...

Private Sub Form_Load()

Dim aop As AccessObjectProperty
For Each aop In CurrentProject.Properties
'Me.txtProps = Me.txtProps & aop.Name & ": " & aop.Value & vbCrLf
If aop.Name = "MDE" And aop.Value = "T" Then
If CurrentProject.ProjectType = acADP Then
Me.txtProps = "I'm an ADE!"
ElseIf CurrentProject.ProjectType = acMDB Then
Me.txtProps = "I'm an MDE!"
Else
Me.txtProps = "I don't know what I am!"
End If
Exit Sub
End If
Next aop

If CurrentProject.ProjectType = acADP Then
Me.txtProps = "I'm an ADP!"
ElseIf CurrentProject.ProjectType = acMDB Then
Me.txtProps = "I'm an MDB!"
Else
Me.txtProps = "I don't know what I am!"
End If

End Sub
 
Hi Brendan

Nice logic, but my way is a lot quicker when it runs.....

Quick AND dirty! I like it

Regards

Steve
 
I wouldn't want to put my trust in the file extension. It's too easily
changed. But of course it's for you to decide what works for you.
 
Agreed on all points, but the way the app is deployed means the extension
won't be an issue in this case.

Thanks again, Brendan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top