문제

컴파일 할 문제가 발생하면 'incdntno.value'에서 컴파일하는 동안 정의되지 않은 변수 오류를 유지합니다.나는 정수로 incdntno를 희미하게하려고 노력했지만 잘못된 한정자를 얻으려고했습니다.비슷한 코드가 작동합니다 (두 번째 코드 블록 참조).나는 작업 코드 부분에서 일어나고있는 많은 것을 필요로하지 않았기 때문에 그것을 제거했습니다.누군가가 첫 번째 코드 블록에서 내가 어디로 가는지 지적 할 수 있다면 나는 너무 감사 할 것입니까?고마워, 대단히

Private Sub Incdntno_AfterUpdate()
  Dim conn As ADODB.Connection
  Dim sSQL As String



  Set conn = CurrentProject.Connection


  If IsNull([Incdntno]) Then
    Me.Dirty = False
  End If
  Dim Incident As String
  Incident = Incdntno.Value
  sSQL = "INSERT INTO tblFieldIncident_Complaint_InspHist ( Incdntno, InspectID, Dt_Inspect ) SELECT " & [Incdntno] & ", " & [InspectID] & ", " & [InspDate] & " FROM tblInspect WHERE Incdntno='" & Incident & "';"
  conn.Execute sSQL
  'Me.Requery
  frmInspectItemsSub.Requery

ProcExit:
    Exit Sub

End Sub
.

작동 코드 :

Private Sub InspectType_AfterUpdate()
  Dim conn As ADODB.Connection
  Dim sSQL As String
  Dim wYesNo As Integer
  On Error GoTo ProcErr

  If Not mbNewRecord Then
wYesNo = MsgBox("Changing the inspection type will erase the current entries and insert items specific to the new inspection. Proceed?", vbYesNo, "Inspection item update")
    If wYesNo <> vbYes Then GoTo ProcExit
  End If

   Set conn = CurrentProject.Connection
  If Not mbNewRecord Then
conn.Execute "DELETE FROM tblInspectItems WHERE InspectID=" & InspectID
  End If

  If IsNull([InspectID]) Then
    Me.Dirty = False
  End If
  Dim inspType As String
  inspType = InspectType.Value
  sSQL = "INSERT INTO tblInspectItems ( ItemID, InspectID ) SELECT ItemID, " & [InspectID] & " FROM tblRefInspectItemCodes WHERE InspectType='" & inspType & "';"
  conn.Execute sSQL
  'Me.Requery
  frmInspectItemsSub.Requery

ProcExit:
    Exit Sub

ProcErr:
  ErrMsg ("frmInspect.InspectType_AfterUpdate")
  Resume ProcExit
End Sub
.

도움이 되었습니까?

해결책

이벤트 코드를 복제하면 일어나는 일이 발생합니다.귀하의 통제 이름을 가까이보고 일치하는지 확인하십시오.또한 [이벤트 프로 시저]가 이벤트 속성에 나타나는지 확인하려고합니다.컨트롤 이름을 변경하면 해당 링크가 자동으로 나타나지 않을 수 있습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top