biasanya saya kalo buat filter sbb:
strKriteria = "[CustomerID]='A' AND [ProductID] = 'CC' AND OrderDate 
>=#01/01/7# AND ORderDate <= #01/12/07#"
Me.FilterOn=false
Me.filter = strKriteria
Me.FilterOn = true


  ----- Original Message ----- 
  From: my_news01 
  To: [email protected] 
  Sent: Friday, October 26, 2007 03:03
  Subject: [belajar-access] cara buat filter ???


  Hi all members,

  saya lagi belajar access, saya coba buat modifikasi order entry.mdb
  yang ada di template access.
  Persoalan saya sbb:
  Saya ingin membuat filter / criteria dengan contoh sbb:
  Ada Customer: A, B, C, D
  Product : AA, BB, CC, DD
  Date Sales: 01/01/07 sampai 01/12/07
  lalu saya ingin filter agar tampilan sbb:
  hanya customer A dengan Product CC dengan tanggal 01/01/07 sampai
  05/02/07 doang ??? Caranya ??? Berikut kode VBA yang saya coba untuk
  formnya apa sudah betul dan saya masih bingung untuk buat kode
  filternya ???
  ada yang bisa tolong saya ???

  Private Sub Form_Open(Cancel As Integer)
  Me.Caption = Forms![1Report Range Customer].OpenArgs
  Me.Form.FilterOn = True
  End Sub

  Private Sub Preview_Click()
  Dim intBad As Integer
  If IsNull(Me![Range Customer Begin]) Or IsNull(Me![Range Customer
  End]) Then MsgBox "You must enter both beginning and ending Customer."
  Me![Range Customer Begin].SetFocus
  intBad = True
  End If

  If IsNull(Me![Range Product Begin]) Or _
  IsNull(Me![Range Product End]) Then
  MsgBox "You must enter both beginning and ending Product."
  Me![Range Product Begin].SetFocus
  intBad = True
  End If

  If IsNull(Me![Beginning Order Date]) Or _
  IsNull(Me![Ending Order Date]) Then
  MsgBox "You must enter both beginning and ending dates."
  Me![Beginning Order Date].SetFocus
  intBad = True
  ElseIf Me![Beginning Order Date] > Me![Ending Order Date] Then
  MsgBox "Ending date must be greater than Beginning date."
  Me![Beginning Order Date].SetFocus
  intBad = True
  End If

  If intBad Then Exit Sub
  Me.Visible = False
  ' filter code here ?????? bingung nih ???
  End Sub

  Thanks,
  JG



   

Kirim email ke