Hello everybody.. I have tried to use these codes that I got from a book. I'm using MSFlexGrid, with the Grd name. It was set to be invisible (false visible). And when i enter the year (tahun) needed in the "txttahun" textbox, it will only show the data that related data.

Private Sub cmdPapar_Click()
If optall.Value = True Then
Data1.RecordSource = "SELECT Hari, Bulan, Tahun, ID, Kategori, Status, Jumlah_lulus, Nama FROM permohonan"
Data1.Refresh
Grd.Visible = True
End If
If optbyyear.Value = True And txttahun.Text = "2009" Then
Data1.RecordSource = "SELECT Hari, Bulan, Tahun, ID, Kategori, Status, Jumlah_lulus, Nama FROM permohonan where Tahun = " & " '" & txttahun & "'"
Data1.Refresh
Grd.Visible = True
txtAlatulis09.Visible = True
End If
If optbyyear.Value = True And txttahun.Text = "2010" Then
Data1.RecordSource = "SELECT Hari, Bulan, Tahun, ID, Kategori, Status, Jumlah_lulus, Nama FROM permohonan where Tahun = " & " '" & txttahun & "'"
Data1.Refresh
Grd.Visible = True
txtAlatulis10.Visible = True
End If
End Sub

But, my problem is, when i tried to run it, it dispalys "Error run-time 3061, too few parametes, expected 1." and it debugged at "Data1.Refresh" part of codes. Could anybody here plz correct it, or tell me what i need to do.

Ops... Actually it's because of my own mistake.. :D I have put 'kategori', a field that is not in the data1 itself. Haha!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.