error 0

I

iccsi

I get error 0 when I double click on the mdb file.
I trap the error occur in my AutoExec.
When I double click on AutoExec marco, but it does not have error.
The error does not appear when I compact and repair database which
will automatic run the mdb.

The error does not appear when I debug line by line.

Any suggestion is appreciated,
 
D

Dirk Goldgar

iccsi said:
I get error 0 when I double click on the mdb file.
I trap the error occur in my AutoExec.
When I double click on AutoExec marco, but it does not have error.
The error does not appear when I compact and repair database which
will automatic run the mdb.

The error does not appear when I debug line by line.

Any suggestion is appreciated,


What does your autoexec macro do? What are the series of actions it
performs? If it runs code, what code is the code?
 
I

iccsi

What does your autoexec macro do?  What are the series of actions it
performs?  If it runs code, what code is the code?

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

Thanks for the message,
AutoExec does security check and import data from link table.
All the security check works just fine.
It fails after I add import data code.
I added MsgBox, but it does not show any message direct go to error
handling code.
My question is are there any document for error 0 and are there any
reason that mdb fails only when double click it, it works when double
click on the marco and from repair and comapct databases.

Your help is great appreciated,
 
D

Dirk Goldgar

What does your autoexec macro do? What are the series of actions it
performs? If it runs code, what code is the code?

Thanks for the message,
AutoExec does security check and import data from link table.
All the security check works just fine.
It fails after I add import data code.
I added MsgBox, but it does not show any message direct go to error
handling code.
My question is are there any document for error 0 and are there any
reason that mdb fails only when double click it, it works when double
click on the marco and from repair and comapct databases.

Your help is great appreciated,


===== reply begins =====

I would need to see the code that you are running, that's why I asked what
it was.

Error 0 is no error -- if no error has occurred, the error number is 0.
Most often we see the "Error 0" message when the code has an error-handler,
but doesn't have an Exit Sub statement in the code above the error-handling
code, for the case when no error occurs.

It's not clear to me why your code would run without the message being
displayed under some circumstances and not others, but my guess would be
that, when the message is not displayed, the logic is taking another path.
Again, I would have to see the code in order to understand why.
 
I

iccsi

Thanks for the message,
AutoExec does security check and import data from link table.
All the security check works just fine.
It fails after I add import data code.
I added MsgBox, but it does not show any message direct go to error
handling code.
My question is are there any document for error 0 and are there any
reason that mdb fails only when double click it, it works when double
click on the marco and from repair and comapct databases.

Your help is great appreciated,

===== reply begins =====

I would need to see the code that you are running, that's why I asked what
it was.

Error 0 is no error -- if no error has occurred, the error number is 0.
Most often we see the "Error 0" message when the code has an error-handler,
but doesn't have an Exit Sub statement in the code above the error-handling
code, for the case when no error occurs.

It's not clear to me why your code would run without the message being
displayed under some circumstances and not others, but my guess would be
that, when the message is not displayed, the logic is taking another path..
Again, I would have to see the code in order to understand why.

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)- Hide quoted text -

- Show quoted text -

Private Sub ImportData()
On Error GoTo Err_ImportData

Dim stDocName As String
Dim PreviousDate As Date

PreviouseDate = Get_Previous_Business()


If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then

Exit Sub
End If
If DCount("*", "tblDaily", "[Activity_date] = " & "#" &
PreviouseDate & "#") = 0 And _
DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" &
PreviouseDate & "#") > 0 Then


stDocName = "SP APPEND DATA"
DoCmd.OpenQuery stDocName, acNormal, acEdit


End If

Exit_ImportData:
Exit Sub

Err_ImportData:

Select Case Err
Case 0
Resume Exit_ImportData
Case Else
strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
strErrMsg = strErrMsg & "Error Description: " & Err.Description
MsgBox strErrMsg, vbInformation, "Import Data"
Resume Exit_ImportData
End Select
End Sub


Thanks again,

Here is the code when I import data in AutoExec marco which has error
0 if I double click on mdb.

Thanks again,
 
L

Linq Adams via AccessMonster.com

"If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then"

ELookup() is an Excel function, not an Access function. I think there's an
Excel Object reference Library you can load to use Excel functions in Access;
have you done this?
 
I

iccsi

"If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then"

ELookup() is an Excel function, not an Access function. I think there's an
Excel Object reference Library you can load to use Excel functions in Access;
have you done this?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1

ELookup function is by Allen Browne see the following link.

http://allenbrowne.com/ser-42.html
 
D

Dirk Goldgar

Private Sub ImportData()
On Error GoTo Err_ImportData

Dim stDocName As String
Dim PreviousDate As Date

PreviouseDate = Get_Previous_Business()


If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then

Exit Sub
End If
If DCount("*", "tblDaily", "[Activity_date] = " & "#" &
PreviouseDate & "#") = 0 And _
DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" &
PreviouseDate & "#") > 0 Then


stDocName = "SP APPEND DATA"
DoCmd.OpenQuery stDocName, acNormal, acEdit


End If

Exit_ImportData:
Exit Sub

Err_ImportData:

Select Case Err
Case 0
Resume Exit_ImportData
Case Else
strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
strErrMsg = strErrMsg & "Error Description: " & Err.Description
MsgBox strErrMsg, vbInformation, "Import Data"
Resume Exit_ImportData
End Select
End Sub

===== reply begins =====

Is that a copy/paste of your code? There appears to be a typo in a variable
name:
Dim PreviousDate As Date

PreviouseDate = Get_Previous_Business()

"PreviousDate" or "PreviouseDate"? I would expect the code as written to
give you a compile error, unless you have the "Require Variable Declaration"
option turned off (which is a bad idea). However, I don't think that would
cause an error at run time, and certainly not error 0 (since that isn't an
error).

The error-handling in that code is set to ignore error# 0. I assume you put
that there in an attempt to stop the error message from appearing. Did it
work?

When you get the error message, is it coming from the MsgBox in the
error-handling code above -- you should be able to tell by the content,
formatting, and window title -- or is it coming from someplace else?
 
L

Linq Adams via AccessMonster.com

I believe you're right, Doug!

Of all the things I miss, in old age, I miss my mind the most!
 
I

iccsi

Private Sub ImportData()
On Error GoTo Err_ImportData

    Dim stDocName As String
    Dim PreviousDate As Date

    PreviouseDate = Get_Previous_Business()

    If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then

             Exit Sub
    End If
    If DCount("*", "tblDaily", "[Activity_date] = " & "#" &
PreviouseDate & "#") = 0 And _
       DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" &
PreviouseDate & "#") > 0 Then

      stDocName = "SP APPEND DATA"
      DoCmd.OpenQuery stDocName, acNormal, acEdit

    End If

Exit_ImportData:
    Exit Sub

Err_ImportData:

  Select Case Err
    Case 0
      Resume Exit_ImportData
    Case Else
      strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
      strErrMsg = strErrMsg & "Error Description: " & Err.Description
      MsgBox strErrMsg, vbInformation, "Import Data"
      Resume Exit_ImportData
  End Select
End Sub

===== reply begins =====

Is that a copy/paste of your code?  There appears to be a typo in a variable
name:
   Dim PreviousDate As Date
   PreviouseDate = Get_Previous_Business()

"PreviousDate" or "PreviouseDate"?  I would expect the code as written to
give you a compile error, unless you have the "Require Variable Declaration"
option turned off (which is a bad idea).  However, I don't think that would
cause an error at run time, and certainly not error 0 (since that isn't an
error).

The error-handling in that code is set to ignore error# 0.  I assume you put
that there in an attempt to stop the error message from appearing.  Didit
work?

When you get the error message, is it coming from the MsgBox in the
error-handling code above -- you should be able to tell by the content,
formatting, and window title -- or is it coming from someplace else?

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

Thanks for the message and let me know the typo,
I correct the typo and do some testing and found out that if I take
out

DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" & PreviouseDate &
"#") > 0

condition and works.

The query links to a text file link table.
The code works if I double click on AutoExec, but it fails when double
click on mdb file.
It works when I remove above condition when I double click on the mdb
file.


Thanks again for helping,

,
 
I

iccsi

Private Sub ImportData()
On Error GoTo Err_ImportData

    Dim stDocName As String
    Dim PreviousDate As Date

    PreviouseDate = Get_Previous_Business()

    If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then

             Exit Sub
    End If
    If DCount("*", "tblDaily", "[Activity_date] = " & "#" &
PreviouseDate & "#") = 0 And _
       DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" &
PreviouseDate & "#") > 0 Then

      stDocName = "SP APPEND DATA"
      DoCmd.OpenQuery stDocName, acNormal, acEdit

    End If

Exit_ImportData:
    Exit Sub

Err_ImportData:

  Select Case Err
    Case 0
      Resume Exit_ImportData
    Case Else
      strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
      strErrMsg = strErrMsg & "Error Description: " & Err.Description
      MsgBox strErrMsg, vbInformation, "Import Data"
      Resume Exit_ImportData
  End Select
End Sub

===== reply begins =====

Is that a copy/paste of your code?  There appears to be a typo in a variable
name:
   Dim PreviousDate As Date
   PreviouseDate = Get_Previous_Business()

"PreviousDate" or "PreviouseDate"?  I would expect the code as written to
give you a compile error, unless you have the "Require Variable Declaration"
option turned off (which is a bad idea).  However, I don't think that would
cause an error at run time, and certainly not error 0 (since that isn't an
error).

The error-handling in that code is set to ignore error# 0.  I assume you put
that there in an attempt to stop the error message from appearing.  Didit
work?

When you get the error message, is it coming from the MsgBox in the
error-handling code above -- you should be able to tell by the content,
formatting, and window title -- or is it coming from someplace else?

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

The error handling to ignore error #0, but it does not import data.
The error message is from the from error handling code above.

Thanks again,
 
I

iccsi

Private Sub ImportData()
On Error GoTo Err_ImportData

    Dim stDocName As String
    Dim PreviousDate As Date

    PreviouseDate = Get_Previous_Business()

    If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then

             Exit Sub
    End If
    If DCount("*", "tblDaily", "[Activity_date] = " & "#" &
PreviouseDate & "#") = 0 And _
       DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" &
PreviouseDate & "#") > 0 Then

      stDocName = "SP APPEND DATA"
      DoCmd.OpenQuery stDocName, acNormal, acEdit

    End If

Exit_ImportData:
    Exit Sub

Err_ImportData:

  Select Case Err
    Case 0
      Resume Exit_ImportData
    Case Else
      strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
      strErrMsg = strErrMsg & "Error Description: " & Err.Description
      MsgBox strErrMsg, vbInformation, "Import Data"
      Resume Exit_ImportData
  End Select
End Sub

===== reply begins =====

Is that a copy/paste of your code?  There appears to be a typo in a variable
name:
   Dim PreviousDate As Date
   PreviouseDate = Get_Previous_Business()

"PreviousDate" or "PreviouseDate"?  I would expect the code as written to
give you a compile error, unless you have the "Require Variable Declaration"
option turned off (which is a bad idea).  However, I don't think that would
cause an error at run time, and certainly not error 0 (since that isn't an
error).

The error-handling in that code is set to ignore error# 0.  I assume you put
that there in an attempt to stop the error message from appearing.  Didit
work?

When you get the error message, is it coming from the MsgBox in the
error-handling code above -- you should be able to tell by the content,
formatting, and window title -- or is it coming from someplace else?

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

I tried to move the condition code to main form on FormLoad, I got
text link table does not exist can not import data error.

It seems that MS Access creates link tables specifications and
properties after running AutoExec or MS Access is loaded.

The code fails when I check external link text file record on AutoExec
when I click on mdb, but works after MS Access loaded even I double
click on AutoExec.

If I am right then we unable to check any external data on AutoExec.
Please let me know if I am wrong,

Thanks millions for helping,
 
D

Dirk Goldgar

Private Sub ImportData()
On Error GoTo Err_ImportData

Dim stDocName As String
Dim PreviousDate As Date

PreviouseDate = Get_Previous_Business()

If ELookup("[WorkingDay]", "tblCalendar", "[CalDate] = " & "#" &
PreviouseDate & "#") = "N" Then

Exit Sub
End If
If DCount("*", "tblDaily", "[Activity_date] = " & "#" &
PreviouseDate & "#") = 0 And _
DCount("*", "SP APPEND DATA", "[Mydate] = " & "#" &
PreviouseDate & "#") > 0 Then

stDocName = "SP APPEND DATA"
DoCmd.OpenQuery stDocName, acNormal, acEdit

End If

Exit_ImportData:
Exit Sub

Err_ImportData:

Select Case Err
Case 0
Resume Exit_ImportData
Case Else
strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
strErrMsg = strErrMsg & "Error Description: " & Err.Description
MsgBox strErrMsg, vbInformation, "Import Data"
Resume Exit_ImportData
End Select
End Sub

===== reply begins =====

Is that a copy/paste of your code? There appears to be a typo in a
variable
name:
Dim PreviousDate As Date
PreviouseDate = Get_Previous_Business()

"PreviousDate" or "PreviouseDate"? I would expect the code as written to
give you a compile error, unless you have the "Require Variable
Declaration"
option turned off (which is a bad idea). However, I don't think that would
cause an error at run time, and certainly not error 0 (since that isn't an
error).

The error-handling in that code is set to ignore error# 0. I assume you
put
that there in an attempt to stop the error message from appearing. Did it
work?

When you get the error message, is it coming from the MsgBox in the
error-handling code above -- you should be able to tell by the content,
formatting, and window title -- or is it coming from someplace else?

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

I tried to move the condition code to main form on FormLoad, I got
text link table does not exist can not import data error.

It seems that MS Access creates link tables specifications and
properties after running AutoExec or MS Access is loaded.

The code fails when I check external link text file record on AutoExec
when I click on mdb, but works after MS Access loaded even I double
click on AutoExec.

If I am right then we unable to check any external data on AutoExec.
Please let me know if I am wrong,

Thanks millions for helping,


=========== start of reply =============

You're wrong. Linked tables can be accessed just fine from the AutoExec
macro at startup, at least in Access 2003 where I tested to make sure.
Could it be that you are only creating the link to the table at some later
point in the database's startup process?

Unfortunately, the scheduled closing of this newsgroup on June 1st makes it
unlikely that we will be able to continue this discussion here. You may
need to post it as a new discussion thread in some other forum. I'll be
keeping an eye on the Microsoft Answers forum for the "other" Office
products including Access. Maybe we can pursue it further there.
 

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

Top