21/10/2018, 18:25
DataBilgi
Table kismina "Maliyet Kodu" adli bir field adi ekledim ve bu adi formuma tasidim fakat ne zaman Maliyet Kodu alanina veri girmeye kalksam yukaridaki hatayi aliyirum
If Not IsNull(Me.txtFilterMaliyetKodu) Then
strWhere = strWhere & "([MaliyetKodu] Like ""*" & Me.txtFilterMaliyetKodu & "*"") AND "
End If
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.txtFilterCity) Then
strWhere = strWhere & "([Location] Like ""*" & Me.txtFilterCity & "*"") AND "
End If
If Not IsNull(Me.txtFilterInstalledDate) Then
strWhere = strWhere & "([Installed Date] Like ""*" & Me.txtFilterInstalledDate & "*"") AND "
End If
If Not IsNull(Me.txtFilterMainName) Then
strWhere = strWhere & "([Description] Like ""*" & Me.txtFilterMainName & "*"") AND "
End If
If Not IsNull(Me.txtFilterDepartmen) Then
strWhere = strWhere & "([Departmen] Like ""*" & Me.txtFilterDepartmen & "*"") AND "
End If
'If Not IsNull(Me.txtFilterClassroom) Then
'strWhere = strWhere & "([Classroom] Like ""*" & Me.txtFilterClassroom & "*"") AND "
'End If
If Not IsNull(Me.txtFilterDepot) Then
strWhere = strWhere & "([Depot] Like ""*" & Me.txtFilterDepot & "*"") AND "
End If
If Not IsNull(Me.txtFilterSerialNumber) Then
strWhere = strWhere & "([Serial Number] Like ""*" & Me.txtFilterSerialNumber & "*"") AND "
End If
If Not IsNull(Me.txtFilterMake) Then
strWhere = strWhere & "([Make] Like ""*" & Me.txtFilterMake & "*"") AND "
End If
If Not IsNull(Me.txtFilterModel) Then
strWhere = strWhere & "([Model] Like ""*" & Me.txtFilterModel & "*"") AND "
End If
If Not IsNull(Me.txtFilterMaliyetKodu) Then
strWhere = strWhere & "([MaliyetKodu] Like ""*" & Me.txtFilterMaliyetKodu & "*"") AND "
End If
'If Not IsNull(Me.txtStartDate) Then
' strWhere = strWhere & "([EnteredOn] >= " & Format(Me.txtStartDate, conJetDate) & ") AND "
' End If
'If Not IsNull(Me.txtEndDate) Then
' strWhere = strWhere & "([EnteredOn] < " & Format(Me.txtEndDate + 1, conJetDate) & ") AND "
' End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Bilgi ile ilgili en az bir kriter giriniz!!", vbInformation, "Lütfen Dikkat!!"
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "You cannot add new clients to the search form.", vbInformation, "Permission denied."
End Sub
Private Sub Command64_Click()
On Error GoTo Err_Command64_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command64_Click:
Exit Sub
Err_Command64_Click:
MsgBox Err.Description
Resume Exit_Command64_Click
End Sub
Private Sub add_data_Click()
On Error GoTo Err_add_data_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_add_data_Click:
Exit Sub
Err_add_data_Click:
MsgBox Err.Description
Resume Exit_add_data_Click
End Sub
If Not IsNull(Me.txtFilterMaliyetKodu) Then
strWhere = strWhere & "([MaliyetKodu] Like ""*" & Me.txtFilterMaliyetKodu & "*"") AND "
End If
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.txtFilterCity) Then
strWhere = strWhere & "([Location] Like ""*" & Me.txtFilterCity & "*"") AND "
End If
If Not IsNull(Me.txtFilterInstalledDate) Then
strWhere = strWhere & "([Installed Date] Like ""*" & Me.txtFilterInstalledDate & "*"") AND "
End If
If Not IsNull(Me.txtFilterMainName) Then
strWhere = strWhere & "([Description] Like ""*" & Me.txtFilterMainName & "*"") AND "
End If
If Not IsNull(Me.txtFilterDepartmen) Then
strWhere = strWhere & "([Departmen] Like ""*" & Me.txtFilterDepartmen & "*"") AND "
End If
'If Not IsNull(Me.txtFilterClassroom) Then
'strWhere = strWhere & "([Classroom] Like ""*" & Me.txtFilterClassroom & "*"") AND "
'End If
If Not IsNull(Me.txtFilterDepot) Then
strWhere = strWhere & "([Depot] Like ""*" & Me.txtFilterDepot & "*"") AND "
End If
If Not IsNull(Me.txtFilterSerialNumber) Then
strWhere = strWhere & "([Serial Number] Like ""*" & Me.txtFilterSerialNumber & "*"") AND "
End If
If Not IsNull(Me.txtFilterMake) Then
strWhere = strWhere & "([Make] Like ""*" & Me.txtFilterMake & "*"") AND "
End If
If Not IsNull(Me.txtFilterModel) Then
strWhere = strWhere & "([Model] Like ""*" & Me.txtFilterModel & "*"") AND "
End If
If Not IsNull(Me.txtFilterMaliyetKodu) Then
strWhere = strWhere & "([MaliyetKodu] Like ""*" & Me.txtFilterMaliyetKodu & "*"") AND "
End If
'If Not IsNull(Me.txtStartDate) Then
' strWhere = strWhere & "([EnteredOn] >= " & Format(Me.txtStartDate, conJetDate) & ") AND "
' End If
'If Not IsNull(Me.txtEndDate) Then
' strWhere = strWhere & "([EnteredOn] < " & Format(Me.txtEndDate + 1, conJetDate) & ") AND "
' End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Bilgi ile ilgili en az bir kriter giriniz!!", vbInformation, "Lütfen Dikkat!!"
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub cmdReset_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "You cannot add new clients to the search form.", vbInformation, "Permission denied."
End Sub
Private Sub Command64_Click()
On Error GoTo Err_Command64_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command64_Click:
Exit Sub
Err_Command64_Click:
MsgBox Err.Description
Resume Exit_Command64_Click
End Sub
Private Sub add_data_Click()
On Error GoTo Err_add_data_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAs2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_add_data_Click:
Exit Sub
Err_add_data_Click:
MsgBox Err.Description
Resume Exit_add_data_Click
End Sub