Delay in executing SQL statement

  • Thread starter bifteki via AccessMonster.com
  • Start date
B

bifteki via AccessMonster.com

I have an Access ADP project connected to an SQL Server 2005 DB.
In VBA, I want to export a recordset given from a previous query to Excel
using TransferSpreadsheet. As this command can only accept a table as its
parameter, I first create a new table -to use as a temporary one-, then I
insert the specific rows in it, export it and, finally, delete it from the DB.
The process is triggered through a command button.
However, this doesn't work. I get the message that it can't find the table
'tmptbl_export'. The reason for this is a delay in creating the table. If I
press the button while I have the 'All Access objects' pane open, I can see
that I get the message and -after I press OK- then the table is created!

I give the code below:

Private Sub cmd_export_to_excel_Click()

Dim sql_str As String
Dim rst As Recordset
Dim tableExists As Boolean

Dim errNum As Integer
Dim fileName As String
Dim filePath As String
Dim fso

Dim fileNotExists As Boolean
Dim fileNumber As Integer
Dim tmpFilePath As String


DoCmd.RunSQL "IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[tmptbl_export]') AND type in (N'U')) " & _
"DROP TABLE [dbo].[tmptbl_export]"


sql_str = "CREATE TABLE [dbo].[tmptbl_export] (" & _
"[fld_company_name] [nvarchar](50) NULL, " & _
"[fld_person_name] [varchar](50) NULL, " & _
"[fld_person_surname] [varchar](50) NULL)"


DoCmd.RunSQL sql_str


sql_str = "INSERT INTO dbo.[tmptbl_export] (fld_company_name, fld_person_name,
fld_person_surname) SELECT dbo.tbl_Companies.fld_company_name, dbo.
tbl_Persons.fld_person_name, dbo.tbl_Persons.fld_person_surname " &
txt_sql_conditions.Value


'sql_str = "SELECT dbo.tbl_Companies.fld_company_name, dbo.tbl_Persons.
fld_person_name, dbo.tbl_Persons.fld_person_surname " & _
"INTO dbo.[tmptbl_export] " & txt_sql_conditions.Value


DoCmd.RunSQL sql_str


fileName = CStr(Year(Now)) & (IIf(Len(CStr(Month(Now))) = 1, "0" & CStr(Month
(Now)), (CStr(Month(Now))))) & (IIf(Len(CStr(Day(Now))) = 1, "0" & CStr(Day
(Now)), (CStr(Day(Now)))))
filePath = "P:\test_folder\" & fileName & "_eortazontes"


Set fso = CreateObject("Scripting.FileSystemObject")

fileNumber = 0

Do
fileNumber = fileNumber + 1
tmpFilePath = filePath & "_" & fileNumber & ".xls"

If Not fso.FileExists(tmpFilePath) Then
fileNotExists = True
End If
Loop While fileNotExists = False


DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True


DoCmd.RunSQL "DROP TABLE tmptbl_export"
End Sub

I have also tried doing the creation and insertion in the table with SELECT
INTO (the commented line) but it didn't work either. I also tried to do this
same process with docmd.outputTo but I don't get the expected result, as
docmd.outputTo doesn't support Unicode encoding and I -mostly- have Unicode
in my results.

Does anyone know of any way to overcome this?
 
P

Paul Shapiro

bifteki via AccessMonster.com said:
I have an Access ADP project connected to an SQL Server 2005 DB.
In VBA, I want to export a recordset given from a previous query to Excel
using TransferSpreadsheet. As this command can only accept a table as its
parameter, I first create a new table -to use as a temporary one-, then I
insert the specific rows in it, export it and, finally, delete it from the
DB.
The process is triggered through a command button.
However, this doesn't work. I get the message that it can't find the table
'tmptbl_export'. The reason for this is a delay in creating the table. If
I
press the button while I have the 'All Access objects' pane open, I can
see
that I get the message and -after I press OK- then the table is created!

I give the code below:

Private Sub cmd_export_to_excel_Click()

Dim sql_str As String
Dim rst As Recordset
Dim tableExists As Boolean

Dim errNum As Integer
Dim fileName As String
Dim filePath As String
Dim fso

Dim fileNotExists As Boolean
Dim fileNumber As Integer
Dim tmpFilePath As String


DoCmd.RunSQL "IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[tmptbl_export]') AND type in (N'U')) " & _
"DROP TABLE [dbo].[tmptbl_export]"


sql_str = "CREATE TABLE [dbo].[tmptbl_export] (" & _
"[fld_company_name] [nvarchar](50) NULL, " & _
"[fld_person_name] [varchar](50) NULL, " & _
"[fld_person_surname] [varchar](50) NULL)"


DoCmd.RunSQL sql_str


sql_str = "INSERT INTO dbo.[tmptbl_export] (fld_company_name,
fld_person_name,
fld_person_surname) SELECT dbo.tbl_Companies.fld_company_name, dbo.
tbl_Persons.fld_person_name, dbo.tbl_Persons.fld_person_surname " &
txt_sql_conditions.Value


'sql_str = "SELECT dbo.tbl_Companies.fld_company_name, dbo.tbl_Persons.
fld_person_name, dbo.tbl_Persons.fld_person_surname " & _
"INTO dbo.[tmptbl_export] " & txt_sql_conditions.Value


DoCmd.RunSQL sql_str


fileName = CStr(Year(Now)) & (IIf(Len(CStr(Month(Now))) = 1, "0" &
CStr(Month
(Now)), (CStr(Month(Now))))) & (IIf(Len(CStr(Day(Now))) = 1, "0" &
CStr(Day
(Now)), (CStr(Day(Now)))))
filePath = "P:\test_folder\" & fileName & "_eortazontes"


Set fso = CreateObject("Scripting.FileSystemObject")

fileNumber = 0

Do
fileNumber = fileNumber + 1
tmpFilePath = filePath & "_" & fileNumber & ".xls"

If Not fso.FileExists(tmpFilePath) Then
fileNotExists = True
End If
Loop While fileNotExists = False


DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True


DoCmd.RunSQL "DROP TABLE tmptbl_export"
End Sub

I have also tried doing the creation and insertion in the table with
SELECT
INTO (the commented line) but it didn't work either. I also tried to do
this
same process with docmd.outputTo but I don't get the expected result, as
docmd.outputTo doesn't support Unicode encoding and I -mostly- have
Unicode
in my results.

Does anyone know of any way to overcome this?

I didn't look through all your code to see if there's a better way to
approach this, but you could add a couple of steps to force the completion
of the insert statement before doing the export. First, retrieve the count
of the number of records that are going to be inserted. Then run a loop
checking the count in the temp table and sleeping for a few hundred
milliseconds before proceeding to the Excel export.

However, it seems more likely that one or more of your sql statements are
failing. I would add the FailOnError option to your sql execution to make
sure it's all working. Or step through the Access code while looking at the
db with SQL Server Manager to see what's going on. You can also run SQL
Profiler to see exactly what Access is sending to the server and what the
results are.
 
B

bifteki via AccessMonster.com

I forgot to mention that if I insert a breakpoint right after the insertion
of the rows the table gets created. If then I press F5 it runs fine and I get
the file with the expected results. That's how I figured it's a matter of
this delay and not a matter of the statement itself.

I have also tried with "On Error Resume Next" at the beginning of the code
and with the following code instead of just the docmd.transferspreadsheet ...
line (7874 is the code for "couldn't find table" error):

Do
errNum = 0
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True
'MsgBox "Διαδικασία σε εξέλιξη"
errNum = Err.Number
Loop While errNum = 7874

It just hangs and, when I press CTRL+BREAK, the code terminates and the table
is then created. Of course, no file has been created.

This suggestion may sound silly, I'm not such an expert programmer, but is
there maybe any way to "refresh" the database?


Paul said:
I have an Access ADP project connected to an SQL Server 2005 DB.
In VBA, I want to export a recordset given from a previous query to Excel
[quoted text clipped - 86 lines]
Does anyone know of any way to overcome this?

I didn't look through all your code to see if there's a better way to
approach this, but you could add a couple of steps to force the completion
of the insert statement before doing the export. First, retrieve the count
of the number of records that are going to be inserted. Then run a loop
checking the count in the temp table and sleeping for a few hundred
milliseconds before proceeding to the Excel export.

However, it seems more likely that one or more of your sql statements are
failing. I would add the FailOnError option to your sql execution to make
sure it's all working. Or step through the Access code while looking at the
db with SQL Server Manager to see what's going on. You can also run SQL
Profiler to see exactly what Access is sending to the server and what the
results are.
 
S

Sylvain Lafontaine

Well, the first thing to do would be not to delete the table but only to
truncate it (truncating a table is faster then deleting all of its rows).

You're problem here is not that the table has not yet been created but that
Access doesn't know yet that there is a new table. The first thing to try
would be to replace DoCmd.RunSQL with the CurrentProject.Connection.Execute
method. After that, you can try making a call to the
Application.RefreshDatabaseWindow method (after having set the focus to the
Tables tab of the database window):

CurrentProject.Connection.Execute "Create Table ......."
DoCmd.SelectObject acTable, , True
Application.RefreshDatabaseWindow

(Note: for older versions of ADP, there is a problem with refreshing the
database window, see http://support.microsoft.com/kb/304256 ).

If this doesn't work, you can try adding some delays here and there or even
spicing your code with some calls to DoEvent.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


bifteki via AccessMonster.com said:
I have an Access ADP project connected to an SQL Server 2005 DB.
In VBA, I want to export a recordset given from a previous query to Excel
using TransferSpreadsheet. As this command can only accept a table as its
parameter, I first create a new table -to use as a temporary one-, then I
insert the specific rows in it, export it and, finally, delete it from the
DB.
The process is triggered through a command button.
However, this doesn't work. I get the message that it can't find the table
'tmptbl_export'. The reason for this is a delay in creating the table. If
I
press the button while I have the 'All Access objects' pane open, I can
see
that I get the message and -after I press OK- then the table is created!

I give the code below:

Private Sub cmd_export_to_excel_Click()

Dim sql_str As String
Dim rst As Recordset
Dim tableExists As Boolean

Dim errNum As Integer
Dim fileName As String
Dim filePath As String
Dim fso

Dim fileNotExists As Boolean
Dim fileNumber As Integer
Dim tmpFilePath As String


DoCmd.RunSQL "IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[tmptbl_export]') AND type in (N'U')) " & _
"DROP TABLE [dbo].[tmptbl_export]"


sql_str = "CREATE TABLE [dbo].[tmptbl_export] (" & _
"[fld_company_name] [nvarchar](50) NULL, " & _
"[fld_person_name] [varchar](50) NULL, " & _
"[fld_person_surname] [varchar](50) NULL)"


DoCmd.RunSQL sql_str


sql_str = "INSERT INTO dbo.[tmptbl_export] (fld_company_name,
fld_person_name,
fld_person_surname) SELECT dbo.tbl_Companies.fld_company_name, dbo.
tbl_Persons.fld_person_name, dbo.tbl_Persons.fld_person_surname " &
txt_sql_conditions.Value


'sql_str = "SELECT dbo.tbl_Companies.fld_company_name, dbo.tbl_Persons.
fld_person_name, dbo.tbl_Persons.fld_person_surname " & _
"INTO dbo.[tmptbl_export] " & txt_sql_conditions.Value


DoCmd.RunSQL sql_str


fileName = CStr(Year(Now)) & (IIf(Len(CStr(Month(Now))) = 1, "0" &
CStr(Month
(Now)), (CStr(Month(Now))))) & (IIf(Len(CStr(Day(Now))) = 1, "0" &
CStr(Day
(Now)), (CStr(Day(Now)))))
filePath = "P:\test_folder\" & fileName & "_eortazontes"


Set fso = CreateObject("Scripting.FileSystemObject")

fileNumber = 0

Do
fileNumber = fileNumber + 1
tmpFilePath = filePath & "_" & fileNumber & ".xls"

If Not fso.FileExists(tmpFilePath) Then
fileNotExists = True
End If
Loop While fileNotExists = False


DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True


DoCmd.RunSQL "DROP TABLE tmptbl_export"
End Sub

I have also tried doing the creation and insertion in the table with
SELECT
INTO (the commented line) but it didn't work either. I also tried to do
this
same process with docmd.outputTo but I don't get the expected result, as
docmd.outputTo doesn't support Unicode encoding and I -mostly- have
Unicode
in my results.

Does anyone know of any way to overcome this?
 
B

bifteki via AccessMonster.com

If I just truncate the table, then I know there will be no problem, because
when it throws an error and I break the code and then run it again, the code
runs perfectly and the file gets created (because the table is already there).
The problem is we don't want this unnecessary table to exist in our database.
That's why I wanted to create it as a temporary table and delete it when I
don't need it anymore.

I replaced DoCmd.RunSQL with CurrentProject.Connection.Execute and I added
the lines to refresh the window, but still no good. The table gets added to
the list right after I press "End" on the error window.

I tried putting a delay with the code that I gave you before:

Do
errNum = 0
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True

msgbox "The process has started"

errNum = Err.Number
'Loop While errNum = 7874

I even added the messagebox to see if it helps.
But this just goes on forever. I get the hourglass cursor and I can only
break the code. Which means that as long as I am running code the table won't
be created. (??? :-S)

Any more ideas on this? Maybe it'a matter of the system priorities on SQL
Server and Access?



Sylvain said:
Well, the first thing to do would be not to delete the table but only to
truncate it (truncating a table is faster then deleting all of its rows).

You're problem here is not that the table has not yet been created but that
Access doesn't know yet that there is a new table. The first thing to try
would be to replace DoCmd.RunSQL with the CurrentProject.Connection.Execute
method. After that, you can try making a call to the
Application.RefreshDatabaseWindow method (after having set the focus to the
Tables tab of the database window):

CurrentProject.Connection.Execute "Create Table ......."
DoCmd.SelectObject acTable, , True
Application.RefreshDatabaseWindow

(Note: for older versions of ADP, there is a problem with refreshing the
database window, see http://support.microsoft.com/kb/304256 ).

If this doesn't work, you can try adding some delays here and there or even
spicing your code with some calls to DoEvent.
I have an Access ADP project connected to an SQL Server 2005 DB.
In VBA, I want to export a recordset given from a previous query to Excel
[quoted text clipped - 86 lines]
Does anyone know of any way to overcome this?
 
B

bifteki via AccessMonster.com

I also tried with a Sleep function.
I did the following declaration
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and then I did the following call
Sleep 60000
from just before the INSERT INTO statement.
This means I stopped the application for 60 seconds.
It still didn't do the job.

If I just truncate the table, then I know there will be no problem, because
when it throws an error and I break the code and then run it again, the code
runs perfectly and the file gets created (because the table is already there).
The problem is we don't want this unnecessary table to exist in our database.
That's why I wanted to create it as a temporary table and delete it when I
don't need it anymore.

I replaced DoCmd.RunSQL with CurrentProject.Connection.Execute and I added
the lines to refresh the window, but still no good. The table gets added to
the list right after I press "End" on the error window.

I tried putting a delay with the code that I gave you before:

Do
errNum = 0
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True

msgbox "The process has started"

errNum = Err.Number
'Loop While errNum = 7874

I even added the messagebox to see if it helps.
But this just goes on forever. I get the hourglass cursor and I can only
break the code. Which means that as long as I am running code the table won't
be created. (??? :-S)

Any more ideas on this? Maybe it'a matter of the system priorities on SQL
Server and Access?
Well, the first thing to do would be not to delete the table but only to
truncate it (truncating a table is faster then deleting all of its rows).
[quoted text clipped - 21 lines]
 
S

Sylvain Lafontaine

First, I'm very surprised that the RefreshDatabaseWindow method didn't work
in your case. If there a possibility that there was already a XLS file
there that your forgot to delete? See
http://www.pcreview.co.uk/forums/thread-1624989.php for more info and
another example.

Second, I don't see what's the problem about having or not this *unecessary*
table in your database. If you really have a good reason to not have it,
then you could try with putting it into another database.

Instead of exporting a table, you could try exporting from a stored
procedure. For example, by using the DoCmd.Output method:

docmd.OutputTo acOutputStoredProcedure,"MySP",acFormatXLS, "c:\Mytest.xls"

If you have parameters, you create a SQL string by adding the EXEC command
before the name of the SP and the parameters after that. Of course, this is
now a sql string that you are executing, no longer a SP, so you much change
the type of the option acOutputStoredProcedure to something else like
acOutputServerView:

DoCmd.OutputTo acOutputServerView, "exec dbo.MySP 10", acFormatXLS,
"c:\Mytest.xls", True

For the TransferSpreadSheet method, it's the same principle if I remember
correctly but I'm not sure if you can use this method with anything else but
a table or a view.

Finally, if nothing else work, then you could make the export yourself;
something like:

'Transfert des resultats
Dim xlApp As Excel.Application
Dim wbk As Excel.Workbook
' Ouvrir le fichier
Set xlApp = CreateObject("Excel.Application")
Set wbk = xlApp.Workbooks.Open(nomFich)

'Récupération des noms de champs
Dim Rs As Recordset
Set Rs = qd.OpenRecordset()
For i = 0 To Rs.Fields.Count - 1
wbk.Sheets(nomFeuille).Cells(1, i + 1).Value = Rs.Fields(i).Name
Next
'Récupération des données.
wbk.Sheets(nomFeuille).Range("A2").CopyFromRecordset Rs

' Fermer le classeur en enregistrant les changements
wbk.Close True
Set wbk = Nothing

' Quitter Excel
xlApp.Quit
Set xlApp = Nothing

DoCmd.DeleteObject acQuery, nomFeuille
oDb.Close
Set Rs = Nothing
Set qd = Nothing
Set oDb = Nothing

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


bifteki via AccessMonster.com said:
I also tried with a Sleep function.
I did the following declaration
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and then I did the following call
Sleep 60000
from just before the INSERT INTO statement.
This means I stopped the application for 60 seconds.
It still didn't do the job.

If I just truncate the table, then I know there will be no problem,
because
when it throws an error and I break the code and then run it again, the
code
runs perfectly and the file gets created (because the table is already
there).
The problem is we don't want this unnecessary table to exist in our
database.
That's why I wanted to create it as a temporary table and delete it when I
don't need it anymore.

I replaced DoCmd.RunSQL with CurrentProject.Connection.Execute and I added
the lines to refresh the window, but still no good. The table gets added
to
the list right after I press "End" on the error window.

I tried putting a delay with the code that I gave you before:

Do
errNum = 0
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True

msgbox "The process has started"

errNum = Err.Number
'Loop While errNum = 7874

I even added the messagebox to see if it helps.
But this just goes on forever. I get the hourglass cursor and I can only
break the code. Which means that as long as I am running code the table
won't
be created. (??? :-S)

Any more ideas on this? Maybe it'a matter of the system priorities on SQL
Server and Access?
Well, the first thing to do would be not to delete the table but only to
truncate it (truncating a table is faster then deleting all of its rows).
[quoted text clipped - 21 lines]
Does anyone know of any way to overcome this?
 
S

Sylvain Lafontaine

See also: http://www.ureader.com/msg/1046420.aspx

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


Sylvain Lafontaine said:
First, I'm very surprised that the RefreshDatabaseWindow method didn't
work in your case. If there a possibility that there was already a XLS
file there that your forgot to delete? See
http://www.pcreview.co.uk/forums/thread-1624989.php for more info and
another example.

Second, I don't see what's the problem about having or not this
*unecessary* table in your database. If you really have a good reason to
not have it, then you could try with putting it into another database.

Instead of exporting a table, you could try exporting from a stored
procedure. For example, by using the DoCmd.Output method:

docmd.OutputTo acOutputStoredProcedure,"MySP",acFormatXLS, "c:\Mytest.xls"

If you have parameters, you create a SQL string by adding the EXEC command
before the name of the SP and the parameters after that. Of course, this
is now a sql string that you are executing, no longer a SP, so you much
change the type of the option acOutputStoredProcedure to something else
like acOutputServerView:

DoCmd.OutputTo acOutputServerView, "exec dbo.MySP 10", acFormatXLS,
"c:\Mytest.xls", True

For the TransferSpreadSheet method, it's the same principle if I remember
correctly but I'm not sure if you can use this method with anything else
but a table or a view.

Finally, if nothing else work, then you could make the export yourself;
something like:

'Transfert des resultats
Dim xlApp As Excel.Application
Dim wbk As Excel.Workbook
' Ouvrir le fichier
Set xlApp = CreateObject("Excel.Application")
Set wbk = xlApp.Workbooks.Open(nomFich)

'Récupération des noms de champs
Dim Rs As Recordset
Set Rs = qd.OpenRecordset()
For i = 0 To Rs.Fields.Count - 1
wbk.Sheets(nomFeuille).Cells(1, i + 1).Value = Rs.Fields(i).Name
Next
'Récupération des données.
wbk.Sheets(nomFeuille).Range("A2").CopyFromRecordset Rs

' Fermer le classeur en enregistrant les changements
wbk.Close True
Set wbk = Nothing

' Quitter Excel
xlApp.Quit
Set xlApp = Nothing

DoCmd.DeleteObject acQuery, nomFeuille
oDb.Close
Set Rs = Nothing
Set qd = Nothing
Set oDb = Nothing

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


bifteki via AccessMonster.com said:
I also tried with a Sleep function.
I did the following declaration
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and then I did the following call
Sleep 60000
from just before the INSERT INTO statement.
This means I stopped the application for 60 seconds.
It still didn't do the job.

If I just truncate the table, then I know there will be no problem,
because
when it throws an error and I break the code and then run it again, the
code
runs perfectly and the file gets created (because the table is already
there).
The problem is we don't want this unnecessary table to exist in our
database.
That's why I wanted to create it as a temporary table and delete it when
I
don't need it anymore.

I replaced DoCmd.RunSQL with CurrentProject.Connection.Execute and I
added
the lines to refresh the window, but still no good. The table gets added
to
the list right after I press "End" on the error window.

I tried putting a delay with the code that I gave you before:

Do
errNum = 0
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dbo.
tmptbl_export", tmpFilePath, True

msgbox "The process has started"

errNum = Err.Number
'Loop While errNum = 7874

I even added the messagebox to see if it helps.
But this just goes on forever. I get the hourglass cursor and I can only
break the code. Which means that as long as I am running code the table
won't
be created. (??? :-S)

Any more ideas on this? Maybe it'a matter of the system priorities on SQL
Server and Access?

Well, the first thing to do would be not to delete the table but only to
truncate it (truncating a table is faster then deleting all of its
rows).
[quoted text clipped - 21 lines]

Does anyone know of any way to overcome this?
 
B

bifteki via AccessMonster.com

Because of the way I name its file, existing .xls files can't be a problem.
They are named with a sequential number added in the end, after the code has
checked which is the first available one. After all, even when I delete all
files from the folder it still doesn't work.

I tried refreshing the database window with both ways you suggested
(RefreshDatabaseWindow and the one you linked me to). The problem with
OutputTo is that it doesn't support Unicode and most of my results are in
Unicode encoding (Greek language). I get the expected file but the results
are unreadable.

Anyway I decided to choose a conciliatory solution: I'll create a new table
whenever the form is opened and drop it whenever it's closed.

Thanks for your help. :)

Sylvain said:
See also: http://www.ureader.com/msg/1046420.aspx
First, I'm very surprised that the RefreshDatabaseWindow method didn't
work in your case. If there a possibility that there was already a XLS
[quoted text clipped - 111 lines]
 

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