Форумы HiProg.com - MS ACCESS, VBA, VB

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

ник: ddi
да вот

Option Compare Database
Option Explicit
Private Sub erse_Click()
    On Error Resume Next
    delen
       If (IsNumeric(order)) Then
        DoCmd.RunCommand acCmdUndo
    End If
    DoCmd.GoToControl "id"
End Sub
Private Sub Form_Load()
    Form.RecordSource = "pen"
    Me.id.ControlSource = "nomer_sch1"
    Me.order.ControlSource = "ID_IZM"
    Me.Date.ControlSource = "DATA_OPL"
    Me.enid.ControlSource = "IDENERGY"
    Me.Gumar.ControlSource = "SUMA"
    Dim r1
    Dim r2
    Dim r3
    r1 = DLookup("[Usysdb]![db]", "Usysdb", "[Usysdb]![id]=" & (2))
    r2 = DLookup("[UsysdbProtect]![dbz]", "Usysdbprotect", "[UsysdbProtect]![id]=" & (3))
    r3 = DLookup("[UsysdbProtect]![dbx]", "Usysdbprotect", "[UsysdbProtect]![id]=" & (3))
       If (r1 <> r2 And r1 <> r3) Then
        Beep
        MsgBox "Error 1001: Ask your administrator", vbOKOnly, ""
    End If
    Forms("en").Recordset.AddNew
    Me.id.SetFocus
    DoCmd.Maximize
    End Sub
Private Sub id_AfterUpdate()
    Dim dolg As Long
        Me.aah = DLookup(" [eldb1]![fio] ", "eldb1", " [eldb1]![nomer_sch1]  = " & Nz(Me.id, 0))
        Me.adress = DLookup(" [eldb1]![adres] ", "eldb1", " [eldb1]![nomer_sch1]  = " & Nz([id], 0)) & " " & DLookup(" [eldb1]![dom] ", "eldb1", " [eldb1]![nomer_sch1]  = " & Nz([id], 0)) & " " & DLookup(" [eldb1]![kvartira] ", "eldb1", " [eldb1]![nomer_sch1]  = " & Nz([id], 0))
        Me.cuc = DLookup(" [eldb2]![pokazpr] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0)) & " | " & DLookup(" [eldb2]![pokaz] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0))
        Me.rasx = DLookup(" [eldb2]![suma] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0)) & [t1] & DLookup(" [eldb2]![data_opl] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0))
        Me.rasxdram = DLookup(" [eldb2]![raznica] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0)) & t4 & DLookup(" [eldb2]![raznicasum] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0)) & t3 & DLookup(" [eldb2]![tar] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0)) & t2
        dolg = DLookup(" [eldb2]![dolg] ", "eldb2", " [eldb2]![nomer_sch]  = " & Nz([id], 0))
    If ([dolg] < 0) Then
        Me.hh = (-[dolg]) & t5
    End If
    If ([dolg] > 0) Then
        Me.hh = [dolg] & t6
    End If
    If ([dolg] = 0) Then
        Me.hh = [dolg] & t7
    End If
End Sub
Private Sub save___print_Click()
        If (IsNull(id)) Or (id = 0) Or (id < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#224;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(aah) And IsNull(adress)) Or (IsError(aah) And IsError(adress)) Then
        Beep
        MsgBox "&#192;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240; &#238;&#242;&#241;&#243;&#241;&#242;&#226;&#243;&#229;&#242;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(Gumar)) Or (Gumar = 0) Or (Gumar < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#241;&#243;&#236;&#236;&#243;", vbInformation, ""
        DoCmd.GoToControl "gumar"
        Exit Sub
    End If
    If (Form.Dirty) Then
        DoCmd.RunCommand acCmdSaveRecord
    End If
    Me.enid = DLookup(" [usertmp]![userid] ", "usertmp", " [usertmp]![id]  = " & 1)
    DoCmd.OpenQuery "ensumadd", acViewNormal, acAdd
    DoCmd.OpenReport "enandor", acViewNormal, "", "", acNormal
    delen
    Forms("en").Recordset.AddNew
    Me.id.SetFocus
    End Sub
Private Sub save___print_KeyPress(KeyAscii As Integer)
    If (IsNull(id)) Or (id = 0) Or (id < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#224;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(aah) And IsNull(adress)) Or (IsError(aah) And IsError(adress)) Then
        Beep
        MsgBox "&#192;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240; &#238;&#242;&#241;&#243;&#241;&#242;&#226;&#243;&#229;&#242;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(Gumar)) Or (Gumar = 0) Or (Gumar < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#241;&#243;&#236;&#236;&#243;", vbInformation, ""
        DoCmd.GoToControl "gumar"
        Exit Sub
    End If
    If (Form.Dirty) Then
        DoCmd.RunCommand acCmdSaveRecord
    End If
    Me.enid = DLookup(" [usertmp]![userid] ", "usertmp", " [usertmp]![id]  = " & 1)
    DoCmd.OpenQuery "ensumadd", acViewNormal, acAdd
    DoCmd.OpenReport "enandor", acViewNormal, "", "", acNormal
    delen
    Forms("en").Recordset.AddNew
    Me.id.SetFocus
End Sub
Private Sub Gumar_Click()
    If (IsNull(id)) Or (id = 0) Or (id < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#224;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(aah) And IsNull(adress)) Or (IsError(aah) And IsError(adress)) Then
        Beep
        MsgBox "&#192;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240; &#238;&#242;&#241;&#243;&#241;&#242;&#226;&#243;&#229;&#242;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
End Sub
Private Sub Gumar_KeyPress(KeyAscii As Integer)
    If (IsNull(id)) Or (id = 0) Or (id < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#224;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(aah) And IsNull(adress)) Or (IsError(aah) And IsError(adress)) Then
        Beep
        MsgBox "&#192;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240; &#238;&#242;&#241;&#243;&#241;&#242;&#226;&#243;&#229;&#242;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
End Sub
Private Sub only_save_Click()
    If (IsNull(id)) Or (id = 0) Or (id < 0) Then
        Beep
        MsgBox "&#209; &#237;&#224;&#247;&#224;&#235;&#224; &#226;&#226;&#229;&#228;&#232;&#242;&#229; &#232;&#236;&#255;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(aah) And IsNull(adress)) Or (IsError(aah) And IsError(adress)) Then
        Beep
        MsgBox "&#192;&#225;&#238;&#237;&#229;&#237;&#242;&#241;&#234;&#232;&#233; &#237;&#238;&#236;&#229;&#240; &#238;&#242;&#241;&#243;&#241;&#242;&#226;&#243;&#229;&#242;", vbInformation, ""
        DoCmd.GoToControl "id"
        Exit Sub
    End If
    If (IsNull(Gumar)) Or (Gumar = 0) Or (Gumar < 0) Then
        Beep
        MsgBox "&#194;&#226;&#229;&#228;&#232;&#242;&#229; &#241;&#243;&#236;&#236;&#243;", vbInformation, ""
        DoCmd.GoToControl "gumar"
        Exit Sub
    End If
    If (Form.Dirty) Then
        DoCmd.RunCommand acCmdSaveRecord
    End If
    Me.enid = DLookup(" [usertmp]![userid] ", "usertmp", " [usertmp]![id]  = " & 1)
    DoCmd.OpenQuery "ensumadd", acViewNormal, acAdd
    delen
    DoCmd.GoToRecord acForm, "en", acNewRec
    DoCmd.GoToControl "id"
End Sub
Private Sub Command289_Click()
    If (IsNumeric(order)) Then
        DoCmd.RunCommand acCmdUndo
    End If
    DoCmd.Close acForm, "en"
    DoCmd.OpenForm "finden", acNormal, "", "", , acNormal
End Sub


Ваше имя:

Пароль:

Цитировать: [quote][/quote] Код: [code][/code]
Жирный: [b][/b] Наклонный: [i][/i]
URL: [url][/url] 

Сообщение:

 Размер файла не более 50 Кбт. Большие файлы можно размещать на www.slil.ru

Прикрепить:

 

Для вставки смайлов в текст щелкните по значку.