Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How "If Application.IsCompiled" works

Status
Not open for further replies.

darkhat01

IS-IT--Management
Apr 13, 2006
144
US
If I use the following code should this disable the field on the form so no one can enter anything in it only if it has been compiled or creat an MDE?

Also could someone explain what Me! means? I don't understand why there has to be a "!" after Me.

Private Sub Form_Load()

If Application.IsCompiled = True Then
Me!txtPostDate.Enabled = False
Me!btnPostDate.Enabled = False
Me!txtExceptionName.Enabled = False
End If

End Sub

Thanks so much,

Darkhat01
 
The reason why I am asking this queston is I am getting an error in my code.

Run-time Error '2169':
You can't disable a control while it has the focus.

Not sure what to do to make it loss it's focus.

Thanks,

Darkhat01
 
To loose focus from any control, move focus to another control that is always visible and enabled, like a Return or Exit command button, :
Code:
If Application.IsCompiled = True Then
     [blue]Me!cmdExit.SetFocus[/blue]
     Me!txtPostDate.Enabled = False
     Me!btnPostDate.Enabled = False
     Me!txtExceptionName.Enabled = False
End If

as far as Me! - it points to the Form you are on. You may use
Form1!txtPostDate.Enabled = False, or just skip it.


Have fun.

---- Andy
 
faq705-3569 shows how to check if your database is in MDE format - or not.

John
 
That just checks that the file extension is "adp."
They were introduced in Access 2000, but really you can get around that by having a non standard extension.
I wrote that FAQ when I discovered (accidentally) a very reliable way to tell an MDE file apart from a non MDE file, whether it was a database, an addin or a backend data store with a non standard extension.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top