Transfer data from form to report and then attach report to email (1 Viewer)

cino89

New member
Local time
Yesterday, 20:48
Joined
Oct 23, 2014
Messages
3
Hello!
I have a form in which I put some data and than I have a code that adds data to the table.
I would like to transfer only this added data to the report and tham attach this report to email.
I tried to use method
DoCmd.OpenReport
but I got only empty reports

Code:
Private Sub Command44_Click()
'On Error GoTo ErrorHandler
Dim strSQL As String
Dim objKontrolka As Control
Dim dupli As String
Dim data1 As Date
Dim ZMIANA As Integer
Dim dni As Integer
Dim x As Integer


data1 = Text2.Value
dni = Text4.Value

For x = 1 To dni
ZMIANA = 1


Do Until ZMIANA = 4
dupli = data1 & "-" & ZMIANA
    strSQL = "INSERT INTO Wydajnosci(Duplicate,DATA, ZMIANA, 50_Lays, 50_Star,50_Sticks,42_Lays, 42_Star,42_Sticks,21_Lays, 21_Star,21_Sticks) VALUES('" & _
    dupli & "','" & data1 & "','" & ZMIANA & "','" & Text40.Value & "','" & Text38.Value & "','" & Text42.Value & "','" & Text32.Value & "','" & Text30.Value & "','" & Text34.Value & "','" & Text24.Value & "','" & Text21.Value & "','" & Text26.Value & "');"



    With DoCmd
        .SetWarnings WarningsOn:=False
        .RunSQL sqlstatement:=strSQL
        .SetWarnings WarningsOn:=True
    End With
ZMIANA = ZMIANA + 1
Loop
data1 = data1 + 1
Next

 For Each objKontrolka In Me.Controls

     If objKontrolka.ControlType = acTextBox Then

           objKontrolka.Value = ""
     End If
'Next objKontrolka

Exit Sub

Thanks!
 

Users who are viewing this thread

Top Bottom