From: iccsi on
On May 21, 6:04 pm, "Dirk Goldgar"
<d...(a)NOdataSPAMgnostics.com.invalid> wrote:
> "iccsi" <inu...(a)gmail.com> wrote in message
>
> news:7f39822c-ce55-482c-8021-fa7d0b8c8a41(a)q33g2000vbt.googlegroups.com...
>
> 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)

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,

,
From: iccsi on
On May 21, 6:04 pm, "Dirk Goldgar"
<d...(a)NOdataSPAMgnostics.com.invalid> wrote:
> "iccsi" <inu...(a)gmail.com> wrote in message
>
> news:7f39822c-ce55-482c-8021-fa7d0b8c8a41(a)q33g2000vbt.googlegroups.com...
>
> 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)

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,
From: iccsi on
On May 21, 6:04 pm, "Dirk Goldgar"
<d...(a)NOdataSPAMgnostics.com.invalid> wrote:
> "iccsi" <inu...(a)gmail.com> wrote in message
>
> news:7f39822c-ce55-482c-8021-fa7d0b8c8a41(a)q33g2000vbt.googlegroups.com...
>
> 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,

From: Dirk Goldgar on
"iccsi" <inungh(a)gmail.com> wrote in message
news:26055270-73d0-48ca-a90a-40b9eb8a987b(a)f13g2000vbm.googlegroups.com...
On May 21, 6:04 pm, "Dirk Goldgar"
<d...(a)NOdataSPAMgnostics.com.invalid> wrote:
> "iccsi" <inu...(a)gmail.com> wrote in message
>
> news:7f39822c-ce55-482c-8021-fa7d0b8c8a41(a)q33g2000vbt.googlegroups.com...
>
> 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.

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

(please reply to the newsgroup)