Sql code

radek225

Registered User.
Local time
Today, 08:10
Joined
Apr 4, 2013
Messages
307
I have a code, I'll show a part, because the code is long

Code:
Public Function PrzeniesZlecenie(idStarego As String, kopiuj_pliki As Boolean, kopiuj_montaz As Boolean) As Boolean
PrzeniesZlecenie = False
Dim db As DAO.Database
Dim strSQL As String
Dim recIn As Recordset
Dim ID As String
Dim rs As DAO.Recordset
Dim strLastField1 As String
Dim blad As String
Dim idki() As String
Dim idNowego As String
Dim idNowegoZD As String
Dim i As Integer

   strSQL = "INSERT INTO tblGoraZlecenia ( Nazwa,  [Kolory P], [Kolory T], ID_Zlecenia, [Format_(X)]," & _
               "[Format_(Y)], Ilość, Opis, PapierGramatura ) " & _
             "SELECT Nazwa,  [Kolory P], [Kolory T], '" & idNowego & "', [Format_(X)]," & _
               "[Format_(Y)] , Ilość, Opis, PapierGramatura " & _
             "FROM tblGoraZleceniaZakonczone " & _
             "WHERE ID_Zlecenia ='" & idStarego & "'"
    CurrentDb.Execute strSQL

I would like add new part of sql code but I don't know how to write it.

Insert into tblGoraZlecenia.Id_Pracownika from Forms!frmzlecenieMarzena!Imie where "WHERE ID_Zlecenia ='" & idnowego & "'". I know that the form should be open.
 
It would be easier for the reader to understand if you told us WHAT you are trying to do in "business terms". A function, or a part of a function, that we know nothing about isn't getting your message across.

When you use CurrentDb.Execute strSQL, you should include the dbFailOnError parameter. This will show you an error message should an error occur.
CurrentDb.Execute strSQL,dbFailOnError

Good luck
 
r,

Change the reference for idNowego to:

Forms!NameOfFormYouKnowIsOpen!idNowego

Wayne
 

Users who are viewing this thread

Back
Top Bottom