Error number: 3326

E

ericb

When I use my application within Access everything works well.

But when I use the Package Solution Wizard and make a runtime application
with the same code I get this :

Error number : 3326
This recordset in not updateable

I can't figure out what the problem is, here is the function in which the
problem appears :


' Met la Table Transmission Commande dans un fichier avec un nom unique

Public Function StoreTableTransmission() As String
Dim strFilePath As String
Dim strFileName As String
Dim strfile As String
Dim strHeure, strH, strM, strS As String
Dim mySQL As String

' Fait le nom du fichier
strFilePath = getAppPath() & GetUneString(strDirCommande) & "\"
MsgBox "store 1"

' Le numero du logiciel
strFileName = strFileName & IIf(lngID_logiciel < 10, "0" &
lngID_logiciel, lngID_logiciel)
strFileName = strFileName & "B"
MsgBox "store 2"

' Le ID du client
strFileName = strFileName & IIf(Me!ID_client < 10, "0" & Me!ID_client,
Me!ID_client)
strFileName = strFileName & "D"
MsgBox "store 3"

' Ajoute lheure pour faire un nom de fichier unique
strHeure = Time
strH = IIf(Len(Hour(strHeure)) = 1, "0" & Hour(strHeure), Hour(strHeure))
strM = IIf(Len(Minute(strHeure)) = 1, "0" & Minute(strHeure),
Minute(strHeure))
strS = IIf(Len(Second(strHeure)) = 1, "0" & Second(strHeure),
Second(strHeure))
strFileName = strFileName & strH & strM & strS & "G"
MsgBox "store 4"

' Lextension
strFileName = strFileName & "." & GetUneString(strExtCmdFile)

' Enregistre le nom du fichier dans la table
mySQL = "UPDATE [" & strTableCmd & "]"
mySQL = mySQL + " SET path_fichier_commande = '" & strFilePath & "'"
mySQL = mySQL + ", fichier_commande = '" & strFileName & "' WHERE ID_cmd
= 1;"
MsgBox "store 5"

'DoCmd.SetWarnings False
DoCmd.RunSQL mySQL
'DoCmd.SetWarnings True

' Fait le nom complet
strfile = strFilePath & strFileName
MsgBox "store 6"
' Transfert la table dans un fichier
MsgBox "acOutputTable = " & acOutputTable & " strTableCmd = " & strTableCmd
& " acFormatTXT = " & acFormatTXT & "strfile = " & strfile

DoCmd.OutputTo acOutputTable, strTableCmd, acFormatTXT, strfile, False

MsgBox "store 7"
StoreTableTransmission = strfile
End Function

'------end code

It happens between "store 6" and "store 7", when I print out the argument
everything look OK. What I am doing in this function is to make a unique
file name and store the contents of a table (strTableCmd) in that file. The
table strTableCmd is very small, it only contains 1 record. I regroup
in that table data from different tables. Once the data is collected and
stored in the table, I want to put it on file. I guess this is the right way
of doing it.

What am I doing wrong with the DoCmd.OutputTo function ?

Why am I getting this error msg ?

Thank you for the help.
 
D

Douglas J. Steele

What file name are you using for strfile?

Have you tried using TransferText instead of OutputTo?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


ericb said:
When I use my application within Access everything works well.

But when I use the Package Solution Wizard and make a runtime application
with the same code I get this :

Error number : 3326
This recordset in not updateable

I can't figure out what the problem is, here is the function in which the
problem appears :


' Met la Table Transmission Commande dans un fichier avec un nom unique

Public Function StoreTableTransmission() As String
Dim strFilePath As String
Dim strFileName As String
Dim strfile As String
Dim strHeure, strH, strM, strS As String
Dim mySQL As String

' Fait le nom du fichier
strFilePath = getAppPath() & GetUneString(strDirCommande) & "\"
MsgBox "store 1"

' Le numero du logiciel
strFileName = strFileName & IIf(lngID_logiciel < 10, "0" &
lngID_logiciel, lngID_logiciel)
strFileName = strFileName & "B"
MsgBox "store 2"

' Le ID du client
strFileName = strFileName & IIf(Me!ID_client < 10, "0" & Me!ID_client,
Me!ID_client)
strFileName = strFileName & "D"
MsgBox "store 3"

' Ajoute lheure pour faire un nom de fichier unique
strHeure = Time
strH = IIf(Len(Hour(strHeure)) = 1, "0" & Hour(strHeure),
Hour(strHeure))
strM = IIf(Len(Minute(strHeure)) = 1, "0" & Minute(strHeure),
Minute(strHeure))
strS = IIf(Len(Second(strHeure)) = 1, "0" & Second(strHeure),
Second(strHeure))
strFileName = strFileName & strH & strM & strS & "G"
MsgBox "store 4"

' Lextension
strFileName = strFileName & "." & GetUneString(strExtCmdFile)

' Enregistre le nom du fichier dans la table
mySQL = "UPDATE [" & strTableCmd & "]"
mySQL = mySQL + " SET path_fichier_commande = '" & strFilePath & "'"
mySQL = mySQL + ", fichier_commande = '" & strFileName & "' WHERE
ID_cmd
= 1;"
MsgBox "store 5"

'DoCmd.SetWarnings False
DoCmd.RunSQL mySQL
'DoCmd.SetWarnings True

' Fait le nom complet
strfile = strFilePath & strFileName
MsgBox "store 6"
' Transfert la table dans un fichier
MsgBox "acOutputTable = " & acOutputTable & " strTableCmd = " &
strTableCmd
& " acFormatTXT = " & acFormatTXT & "strfile = " & strfile

DoCmd.OutputTo acOutputTable, strTableCmd, acFormatTXT, strfile, False

MsgBox "store 7"
StoreTableTransmission = strfile
End Function

'------end code

It happens between "store 6" and "store 7", when I print out the argument
everything look OK. What I am doing in this function is to make a unique
file name and store the contents of a table (strTableCmd) in that file.
The
table strTableCmd is very small, it only contains 1 record. I regroup
in that table data from different tables. Once the data is collected and
stored in the table, I want to put it on file. I guess this is the right
way
of doing it.

What am I doing wrong with the DoCmd.OutputTo function ?

Why am I getting this error msg ?

Thank you for the help.
 

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