Pomoc w kodzie sql MS Access
Podczas kompilacji w debbuger podkreśla mi na źółto następujący błąd (ja go wytłuszcze). Czy moźe mi ktoś powiedzieć w czym tkwi problem? Dzięki z góry za odp.
Option Compare Database
Dim cnn As Connection
––––––––––––––––––––––––––––––––––––––––
Private Sub Form_Load()
Set cnn = CurrentProject.Connection
End Sub
––––––––––––––––––––––––––––––––––––––––
Private Sub Lista18_Click()
Dim id_seans
Dim mojsql As String
Dim rcc As Recordset
Dim ile_sprzedano As Integer
Dim ile As Integer
ile = Me.Lista18.Column(5)
Me.ile_miejsc.Value = ile
id_seans = Me.Lista18.Column(0)
mojsql = "SELECT sprzedaź.id_seansu, Sum(sprzedaź.sprzedaz) AS sprzedano" _
& " FROM sprzedaź GROUP BY sprzedaź.id_seansu " _
& " HAVING (((sprzedaź.id_seansu)=" & id_seans & "));"
Set rcc = cnn.Execute(mojsql)
If rcc.EOF() Then
ile_sprzedano = 0
Else
ile_sprzedano = rcc!sprzedano
End If
Me.miejsca_wolne.Value = ile – ile_sprzedano
End Sub
––––––––––––––––––––––––––––––––––––––––––––––––––
Private Sub Polecenie9_Click()
Dim id_seans
Dim ile As Integer
Dim mojsql As String
If IsNull(Me.Zakup.Value) Then
MsgBox "Nie podano liczby kupowanych biletów", vbCritical
Exit Sub
End If
If Me.Zakup.Value Me.miejsca_wolne.Value Then
MsgBox "Niepoprawna liczba kupowanych biletów", vbCritical
Exit Sub
End If
id_seans = Me.Lista18.Column(0)
ile = Me.Zakup.Value
mojsql = "Insert into sprzedaź values (" & id_seans & "," & ile & ");"
cnn.Execute mojsql
MsgBox "Sprzedano", vbExclamation
Me.Zakup.Value = 0
ile = Me.Lista18.Column(5)
mojsql = "SELECT sprzedaź.id_seansu, Sum(sprzedaź.sprzedaz) AS sprzedano" _
& " FROM sprzedaź GROUP BY sprzedaź.id_seansu " _
& " HAVING (((sprzedaź.id_seansu)=" & id_seans & "));"
Set rcc = cnn.Execute(mojsql)
If rcc.EOF() Then
ile_sprzedano = 0
Else
ile_sprzedano = rcc!sprzedano
End If
Me.miejsca_wolne.Value = ile – ile_sprzedano
End Sub
Nastpestwem tego jest pojawienie sie bledu jest Set rcc = cnn.Execute(mojsql)
Option Compare Database
Dim cnn As Connection
––––––––––––––––––––––––––––––––––––––––
Private Sub Form_Load()
Set cnn = CurrentProject.Connection
End Sub
––––––––––––––––––––––––––––––––––––––––
Private Sub Lista18_Click()
Dim id_seans
Dim mojsql As String
Dim rcc As Recordset
Dim ile_sprzedano As Integer
Dim ile As Integer
ile = Me.Lista18.Column(5)
Me.ile_miejsc.Value = ile
id_seans = Me.Lista18.Column(0)
mojsql = "SELECT sprzedaź.id_seansu, Sum(sprzedaź.sprzedaz) AS sprzedano" _
& " FROM sprzedaź GROUP BY sprzedaź.id_seansu " _
& " HAVING (((sprzedaź.id_seansu)=" & id_seans & "));"
Set rcc = cnn.Execute(mojsql)
If rcc.EOF() Then
ile_sprzedano = 0
Else
ile_sprzedano = rcc!sprzedano
End If
Me.miejsca_wolne.Value = ile – ile_sprzedano
End Sub
––––––––––––––––––––––––––––––––––––––––––––––––––
Private Sub Polecenie9_Click()
Dim id_seans
Dim ile As Integer
Dim mojsql As String
If IsNull(Me.Zakup.Value) Then
MsgBox "Nie podano liczby kupowanych biletów", vbCritical
Exit Sub
End If
If Me.Zakup.Value Me.miejsca_wolne.Value Then
MsgBox "Niepoprawna liczba kupowanych biletów", vbCritical
Exit Sub
End If
id_seans = Me.Lista18.Column(0)
ile = Me.Zakup.Value
mojsql = "Insert into sprzedaź values (" & id_seans & "," & ile & ");"
cnn.Execute mojsql
MsgBox "Sprzedano", vbExclamation
Me.Zakup.Value = 0
ile = Me.Lista18.Column(5)
mojsql = "SELECT sprzedaź.id_seansu, Sum(sprzedaź.sprzedaz) AS sprzedano" _
& " FROM sprzedaź GROUP BY sprzedaź.id_seansu " _
& " HAVING (((sprzedaź.id_seansu)=" & id_seans & "));"
Set rcc = cnn.Execute(mojsql)
If rcc.EOF() Then
ile_sprzedano = 0
Else
ile_sprzedano = rcc!sprzedano
End If
Me.miejsca_wolne.Value = ile – ile_sprzedano
End Sub
Nastpestwem tego jest pojawienie sie bledu jest Set rcc = cnn.Execute(mojsql)
Odpowiedzi: 0
Strona 0 / 0