Path to file in insert statement

jera

Registered User.
Local time
Today, 01:41
Joined
Oct 29, 2012
Messages
15
Hey guys!

So I still have my database containing construction sites inspections of such.
To every inspection there are minutes of meeting which should be somehow shown in the database.
The user chooses the file using a form, the file is copied to a specific folder on the server and the UNC path should be saved in the database.

A UNC path looks like that \\server\folder\folder\file.docx

When the user klicks "save inspection" the entry including the path to the file on the server should be saved on the db using this statement

Code:
    insert = "INSERT INTO Begehung (Datum, Baustelle, Montageleiter, Sicherheitsfachkraft, Leitung, QM, Dateipfad)
VALUES ('" & Datum.Value & "'," & baustelle.Value & "," & mont & "," & sfk & "," & leit & "," & scc & ",'" & pfad & "')"
where the last variable "pfad" contains the path.
I suppose it has something to do with the backslashes (because I just inserted the one entity and the value, the statement was fine before) but when I look at the insert variable during debug it looks fine: '\\server\folder\folder\file.docx'

Any ideas on that?
 
Do you get any error message? If yes, then show it, (not only the error number).
Show also the content of the insert-variable.
 
Sorry, I forgot that

I get the error message

Run-time error ‘3061’:
Too few parameters. Expected 1

but the value of the insert variable is the following:
Code:
"INSERT INTO Begehung (Datum, Baustelle, Montageleiter, Sicherheitsfachkraft, Leitung, QM, Dateipfad)
VALUES ('23.03.2013', 3, False, False, True, False, '\\server\folder\folder\file.docx')"
 
Sorry, I forgot that

I get the error message

Run-time error ‘3061’:
Too few parameters. Expected 1

but the value of the insert variable is the following:
Code:
"INSERT INTO Begehung (Datum, Baustelle, Montageleiter, Sicherheitsfachkraft, Leitung, QM, Dateipfad)
VALUES ('23.03.2013', 3, False, False, True, False, '\\server\folder\folder\file.docx')"

Sorry, don't know why it submitted twice ..
 
I can't see why you get that error message. I can run the code below without problem.

Code:
   insert = "INSERT INTO Tabel1 ( Id, FalseOrTrue, Dateipfad, mydate )" _
    & "Values (1, True,'" & pfad & "','23-03-2013')"
  dbs.Execute insert
INSERT INTO Tabel1 ( Id, FalseOrTrue, Dateipfad, mydate )Values (1, True,'\\server\folder\folder\file.docx','23-03-2013')

Try to take away 1 parameter at a time, from you query, until it will run.
 

Users who are viewing this thread

Back
Top Bottom