dbTalk Databases Forums  

VBA Editor Erratic Behaviour

comp.databases.ms-access comp.databases.ms-access


Discuss VBA Editor Erratic Behaviour in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave G @ K2
 
Posts: n/a

Default VBA Editor Erratic Behaviour - 07-09-2010 , 04:29 AM






I have problem with one of my A2003 databases. I'm getting strange
behaviour when I type in a module.

For example if I type 'dim x as string' this is what happens:

- after the m of dim then the word dim turns red
- after I type the x then the space disappears leaving me with dimx

Another example, if I try x = "test" then
- as I type the first double quote, another appears

Needless to say this is driving me mad. I've compacted and repaired,
decompiled/recompiled, created a new database and imported all
objects, tried on another machine. Nothing has worked. Other databases
on my system are fine.

Any ideas please

Reply With Quote
  #2  
Old   
Stuart McCall
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-09-2010 , 05:12 AM






"Dave G @ K2" <davegriffiths70 (AT) gmail (DOT) com> wrote

Quote:
I have problem with one of my A2003 databases. I'm getting strange
behaviour when I type in a module.

For example if I type 'dim x as string' this is what happens:

- after the m of dim then the word dim turns red
- after I type the x then the space disappears leaving me with dimx

Another example, if I try x = "test" then
- as I type the first double quote, another appears

Needless to say this is driving me mad. I've compacted and repaired,
decompiled/recompiled, created a new database and imported all
objects, tried on another machine. Nothing has worked. Other databases
on my system are fine.

Any ideas please
You wouldn't have a form with a running timer open when this occurs, would
you? ...

Reply With Quote
  #3  
Old   
Dave G @ K2
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-09-2010 , 11:24 AM



On 9 July, 10:12, "Stuart McCall" <smcc... (AT) myunrealbox (DOT) com> wrote:
Quote:
"Dave G @ K2" <davegriffith... (AT) gmail (DOT) com> wrote in messagenews:b8606110-7385-4f74-b4df-d02057c55037 (AT) d16g2000yqb (DOT) googlegroups.com...



I have problem with one of my A2003 databases. I'm getting strange
behaviour when I type in a module.

For example if I type 'dim x as string' *this is what happens:

- after the m of dim then the word dim turns red
- after I type the x then the space disappears leaving me with dimx

Another example, if I try x = "test" then
- as I type the first double quote, another appears

Needless to say this is driving me mad. I've compacted and repaired,
decompiled/recompiled, created a new database and imported all
objects, tried on another machine. Nothing has worked. Other databases
on my system are fine.

Any ideas please

You wouldn't have a form with a running timer open when this occurs, would
you? ...
Yes I do. Now I don't. Solved. Thanks a million

Reply With Quote
  #4  
Old   
Tony Toews
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-10-2010 , 07:57 PM



On Fri, 9 Jul 2010 08:24:19 -0700 (PDT), "Dave G @ K2"
<davegriffiths70 (AT) gmail (DOT) com> wrote:

Quote:
You wouldn't have a form with a running timer open when this occurs, would
you? ...

Yes I do. Now I don't. Solved.
<smile>

What I do is I check to see if this is an MDE. If yes then it's the
users running the database so I set the timer.

Public Function IsMDE() As Boolean

Dim db As DAO.Database

On Error GoTo tagError

Set db = CurrentDb
If db.Properties("MDE") = "T" Then
IsMDE = True
End If
tagNoProperty:
db.Close: Set db = Nothing

On Error GoTo 0
Exit Function

tagError:
Select Case Err.Number
Case 3270 ' Property not found
IsMDE = False
Resume tagNoProperty
Case Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure IsMDE of Module mdltt_FixReferences"
End Select

End Function

Tony


--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
  #5  
Old   
Stuart McCall
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-10-2010 , 08:41 PM



"Tony Toews" <ttoews (AT) telusplanet (DOT) net> wrote

Quote:
On Fri, 9 Jul 2010 08:24:19 -0700 (PDT), "Dave G @ K2"
davegriffiths70 (AT) gmail (DOT) com> wrote:

You wouldn't have a form with a running timer open when this occurs,
would
you? ...

Yes I do. Now I don't. Solved.

smile

What I do is I check to see if this is an MDE. If yes then it's the
users running the database so I set the timer.

Public Function IsMDE() As Boolean

Dim db As DAO.Database

On Error GoTo tagError

Set db = CurrentDb
If db.Properties("MDE") = "T" Then
IsMDE = True
End If
tagNoProperty:
db.Close: Set db = Nothing

On Error GoTo 0
Exit Function

tagError:
Select Case Err.Number
Case 3270 ' Property not found
IsMDE = False
Resume tagNoProperty
Case Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure IsMDE of Module mdltt_FixReferences"
End Select

End Function

Tony


--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Here's how I'd write that:

Public Function IsMDE() As Boolean
On Error Resume Next
IsMDE = (CurrentDb.Properties("MDE") = "T")
End Function

<g,d&r>

Reply With Quote
  #6  
Old   
David W. Fenton
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-11-2010 , 02:17 PM



"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote in
news:Fr8_n.169687$aS3.133763@hurricane:

Quote:
Here's how I'd write that:

Public Function IsMDE() As Boolean
On Error Resume Next
IsMDE = (CurrentDb.Properties("MDE") = "T")
End Function
I would never write code like that, because there is a history with
On Error Resume Next not going out of scope.

When I see that code, I react "lazy programmer."

Use an error handler that ignores the specific error and then you
don't run the danger of losing error reporting in other places.

In fact, that's what Tony's code does, and it can be used for any
database, not just the one currently opened in the UI.

So, it seems to me your version is inferior to Tony's in every way.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Reply With Quote
  #7  
Old   
Stuart McCall
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-11-2010 , 08:45 PM



"David W. Fenton" <XXXusenet (AT) dfenton (DOT) com.invalid> wrote

Quote:
"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote in
news:Fr8_n.169687$aS3.133763@hurricane:

Here's how I'd write that:

Public Function IsMDE() As Boolean
On Error Resume Next
IsMDE = (CurrentDb.Properties("MDE") = "T")
End Function

I would never write code like that, because there is a history with
On Error Resume Next not going out of scope.

When I see that code, I react "lazy programmer."

Use an error handler that ignores the specific error and then you
don't run the danger of losing error reporting in other places.

In fact, that's what Tony's code does, and it can be used for any
database, not just the one currently opened in the UI.

So, it seems to me your version is inferior to Tony's in every way.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
I take it you didn't notice the <g,d&r> at the end. Sigh. Get over it David.

Reply With Quote
  #8  
Old   
Stuart McCall
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-11-2010 , 09:09 PM



Quote:
it can be used for any
database, not just the one currently opened in the UI.
When I see that statement I react "blind programmer".

Reply With Quote
  #9  
Old   
David W. Fenton
 
Posts: n/a

Default Re: VBA Editor Erratic Behaviour - 07-12-2010 , 02:40 PM



"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote in
news:tAt_n.154596$_F1.101108@hurricane:

Quote:
"David W. Fenton" <XXXusenet (AT) dfenton (DOT) com.invalid> wrote in message
news:Xns9DB291529B81Cf99a49ed1d0c49c5bbb2 (AT) 74 (DOT) 209.136.88...
"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote in
news:Fr8_n.169687$aS3.133763@hurricane:

Here's how I'd write that:

Public Function IsMDE() As Boolean
On Error Resume Next
IsMDE = (CurrentDb.Properties("MDE") = "T")
End Function

I would never write code like that, because there is a history
with On Error Resume Next not going out of scope.

When I see that code, I react "lazy programmer."

Use an error handler that ignores the specific error and then you
don't run the danger of losing error reporting in other places.

In fact, that's what Tony's code does, and it can be used for any
database, not just the one currently opened in the UI.

So, it seems to me your version is inferior to Tony's in every
way.

I take it you didn't notice the <g,d&r> at the end. Sigh. Get over
it David.
Get over what?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.