Spiga

Powerfull Searching With Microsoft Access



Background I Create this Toturial because I wish to collect my friends data and also easily do searching with only typing of random keyword, I can to find the data in table.
Only with Microsoft access.

Making simple program for the Searching of data with Microsoft Access we can do with step following.

Create a table in Microsoft access, Design table like this :




Picture 1 : Desain Table.

Try input some data of your freinds.

Now try to make a form, by click Object Form, select New, at window designed form select Form wizard -> OK., corresponding to picture hereunder.



Picture 2 : Create of Form.


Enter in mode of Design view, right click at form select;choose Properties.
Arrange properties following
Record selector = No.

Then form background setting become white colour by right click form > Fillback Collor, Chose white colour

Arrange all box text properties :
Back Style : Transparent
Border Style : Transparent

Adding 1 Object of Frame at Header Form
Add 3 Object of Option, placing in Frame
Add each 1 TextBox and 1 Button.

To make procedure searching of data, Right click Button Command, Click Menu of Build Event.. last selected Code Builder
type this code in window code.

Option Compare Database

Private Sub Command19_Click()
Dim SqlName As String
Dim SqlEmail As String
Dim SqlBlog As String

If IsNull(Me.Text20) Then
MsgBox ("Please input a word before search..."), vbOKOnly, "Pesan"
Exit Sub
End If

If Me.Frame6 = 1 Then
SqlName = "Select Name, email, blog from Freinds where name like '*" & Me.Text20 & "*'"
Me.RecordSource = SqlName
ElseIf Me.Frame6 = 2 Then
SqlEmail = "Select Name, email, blog from Freinds where email like '*" & Me.Text20 & "*'"
Me.RecordSource = SqlEmail
Else
SqlBlog = "Select Name, email, Blog from Freinds where blog like '*" & Me.Text20 & "*'"
Me.RecordSource = SqlBlog
End If

End Sub

Adding a Button command at Header Form and give Caption “Browse All Data”
This step is equal to Command Button before all for the typing of code.
This Button Command function to present all datas in table.
Following this Code :

Private Sub Command21_Click()
Dim SqlAll As String

SqlAll = "Select * from freinds"
Me.RecordSource = SqlAll
End Sub

This our practice end result :



Picture 3 : End Result.

To add and edit data, you can do direct in Form.
That way simple tutorial of Microsoft Access, useful hopefully .

You can download Database File here : Freinds.rar

Related Links

BlogCatalog

free counters