Ответить на сообщение
Вернуться к теме
Вы отвечаете на сообщение:
ник: Силblч ну, например, сделай кнопку и на кнопке...
Private Sub btnSave_Click() Dim ssql$, i&, vl Dim log As New clsLog On Error GoTo err12345 If MsgBox("Сохранить данные?", vbYesNo, "Выбор") = vbNo Then Exit Sub '-- проверка коннекта If conn.State = 0 Then If conn2uafin(ConnString) = 0 Then Err.Number = -1: GoTo err12345 End If '-- попытка обновить данные ClockOn With GridData For i = 1 To .Rows - 4 If .Cell(flexcpText, i, 22) = 0 Then '-- UAH ssql = "update " + s4m + "PCF_PLAN set " & _ " WEEK_UAH = " & nz(Num4Ora(.Cell(flexcpText, i, 11)), "null") & _ ", PAUAH01 = " & nz(Num4Ora(.Cell(flexcpText, i, 12)), "null") & _ ", PAUAH02 = " & nz(Num4Ora(.Cell(flexcpText, i, 13)), "null") & _ ", PAUAH03 = " & nz(Num4Ora(.Cell(flexcpText, i, 14)), "null") & _ ", PAUAH04 = " & nz(Num4Ora(.Cell(flexcpText, i, 15)), "null") & _ ", PAUAH05 = " & nz(Num4Ora(.Cell(flexcpText, i, 16)), "null") & _ ", PAUAH06 = " & nz(Num4Ora(.Cell(flexcpText, i, 17)), "null") & _ ", DAYUAH01 = " & nz(Num4Ora(.Cell(flexcpText, i, 6)), "null") & _ ", DAYUAH02 = " & nz(Num4Ora(.Cell(flexcpText, i, 7)), "null") & _ ", DAYUAH03 = " & nz(Num4Ora(.Cell(flexcpText, i, 8)), "null") & _ ", DAYUAH04 = " & nz(Num4Ora(.Cell(flexcpText, i, 9)), "null") & _ ", DAYUAH05 = " & nz(Num4Ora(.Cell(flexcpText, i, 10)), "null") & _ " where relid = " & .Cell(flexcpText, i, 23) & _ " and matuid = " & .Cell(flexcpText, i, 21) & _ " and datefrom = " & .Cell(flexcpText, i, 18) & _ " and datetill = " & .Cell(flexcpText, i, 19) ElseIf .Cell(flexcpText, i, 22) = 1 Then '-- CUR ssql = "update " + s4m + "PCF_PLAN set " & _ " WEEK_CUR = " & nz(Num4Ora(.Cell(flexcpText, i, 11)), "null") & _ ", PACUR01 = " & nz(Num4Ora(.Cell(flexcpText, i, 12)), "null") & _ ", PACUR02 = " & nz(Num4Ora(.Cell(flexcpText, i, 13)), "null") & _ ", PACUR03 = " & nz(Num4Ora(.Cell(flexcpText, i, 14)), "null") & _ ", PACUR04 = " & nz(Num4Ora(.Cell(flexcpText, i, 15)), "null") & _ ", PACUR05 = " & nz(Num4Ora(.Cell(flexcpText, i, 16)), "null") & _ ", PACUR06 = " & nz(Num4Ora(.Cell(flexcpText, i, 17)), "null") & _ ", DAYCUR01 = " & nz(Num4Ora(.Cell(flexcpText, i, 6)), "null") & _ ", DAYCUR02 = " & nz(Num4Ora(.Cell(flexcpText, i, 7)), "null") & _ ", DAYCUR03 = " & nz(Num4Ora(.Cell(flexcpText, i, 8)), "null") & _ ", DAYCUR04 = " & nz(Num4Ora(.Cell(flexcpText, i, 9)), "null") & _ ", DAYCUR05 = " & nz(Num4Ora(.Cell(flexcpText, i, 10)), "null") & _ " where relid = " & .Cell(flexcpText, i, 23) & _ " and matuid = " & .Cell(flexcpText, i, 21) & _ " and datefrom = " & .Cell(flexcpText, i, 18) & _ " and datetill = " & .Cell(flexcpText, i, 19) End If If Len(ssql) = 0 Then GoTo err12345 conn.Execute (ssql): conn.Execute ("commit") Next i End With ClockOff '-- удачно MsgBox "Данные успешно сохранены", vbInformation, "PCF" Exit Sub err12345: vl = Error MsgBox "Не удалось сохранить данные в базе" & vbCrLf & _ Error & vbCrLf & "Повторите попытку еще раз или" & vbCrLf & _ "обратитесь к разработчикам", vbCritical, "Ошибка #" & Err.Number '-- неудачно '-- инициализация записи log-файла log.Path = App.Path log.vsTitle = "debug" log.Init log.WriteLine vl log.WriteLine ssql Set log = Nothing If conn.State = 1 Then conn.Execute ("rollback") ClockOff Exit Sub End Sub
Ваше имя:
Пароль:
Сообщение:
Прикрепить:
Для вставки смайлов в текст щелкните по значку.