Need help with automatically added date

Just for kix I added a different type of search to your form.
Its a "search as you type" with a listbox. Double click in the listbox to filter your calling form.
 

Attachments

"Search as you type", never cross my mind, I tried it for purpose of diversifying my option on some day, but when I increased the column count to 4, it still only showed the content of Hoten field, what happened here?

Untitled.png
 
you need to Increase to Column Count of the listbox, also you need to add the Column Width.
 
check the list0 rowsource, does it have all the column.
 
no, the Listbox, rowsource.
 
I think may be the problem is in his code

Private Sub Text2_Change()
'SELECT [Bangchinh].[Maluutru], [Bangchinh].[Hoten] FROM Bangchinh;
Dim strSql As String
strSql = "SELECT [Bangchinh].[Maluutru], [Bangchinh].[Hoten] FROM Bangchinh where Hoten like ""*" & Me.Text2.Text & "*"""
Me.List0.RowSource = strSql
End Sub


Text2 is where I enter the keyword.
I wish to put Tuoi field = Age field, Ngay field = Date visit field, they are all number, don't know how to fill the code o_O
 
According to your notes in the DB you were just searching for a client so thats all I included in the SQL. The rowsource is established in code, not in the listbox.

note the following events

Code:
Private Sub Form_Load()
    Me.List0.RowSource = "SELECT Bangchinh.Maluutru, Bangchinh.Hoten, Bangphu.Yeucau, Bangchinh.Ketluan, Bangchinh.Tuoi, Bangchinh.Ngaysieuam,  " & _
    "Bangchinh.Diachi FROM Bangphu INNER JOIN Bangchinh ON Bangphu.Mayeucausieuam = Bangchinh.Mayeucausieuam WHERE Maluutru = 0"
End Sub
Thats just to load a blank record in listbox because I set column heads to yes.

Code:
Private Sub Text2_Change()

    Dim strSql As String

    strSql = "SELECT Bangchinh.Maluutru, Bangchinh.Hoten, Bangphu.Yeucau, Bangchinh.Ketluan, Bangchinh.Tuoi, Bangchinh.Ngaysieuam,  " & _
             "Bangchinh.Diachi FROM Bangphu INNER JOIN Bangchinh ON Bangphu.Mayeucausieuam = Bangchinh.Mayeucausieuam " & _
             "WHERE   [Maluutru] & [Hoten] & [Ngaysieuam] & [Diachi] & [Tuoi] & [Yeucau]   Like ""*" & Me.Text2.Text & "*"""

    Me.List0.RowSource = strSql

End Sub
This is where the rowsource is set for the listbox


heres copy with changes
 

Attachments

Last edited:
it uses Conditional Format (Ribbon->Format->Conditional Formatting).
on the search form i modified, open in Design View, select all the textboxes on the Detail
section of the form.
Go to ribbon and see the Conditional Formatting.
The search which I found has a text box with the content like "... results were found." That search uses a list box, I see this code:
= IIf(ListBoxName.ListCount-1=-1,"0",ListBoxName.ListCount-1) & "results were found."
Can you help me with that on your search db?
 
According to your notes in the DB you were just searching for a client so thats all I included in the SQL. The rowsource is established in code, not in the listbox.

note the following events

Code:
Private Sub Form_Load()
    Me.List0.RowSource = "SELECT Bangchinh.Maluutru, Bangchinh.Hoten, Bangphu.Yeucau, Bangchinh.Ketluan, Bangchinh.Tuoi, Bangchinh.Ngaysieuam,  " & _
    "Bangchinh.Diachi FROM Bangphu INNER JOIN Bangchinh ON Bangphu.Mayeucausieuam = Bangchinh.Mayeucausieuam WHERE Maluutru = 0"
End Sub
Thats just to load a blank record in listbox because I set column heads to yes.

Code:
Private Sub Text2_Change()

    Dim strSql As String

    strSql = "SELECT Bangchinh.Maluutru, Bangchinh.Hoten, Bangphu.Yeucau, Bangchinh.Ketluan, Bangchinh.Tuoi, Bangchinh.Ngaysieuam,  " & _
             "Bangchinh.Diachi FROM Bangphu INNER JOIN Bangchinh ON Bangphu.Mayeucausieuam = Bangchinh.Mayeucausieuam " & _
             "WHERE   [Maluutru] & [Hoten] & [Ngaysieuam] & [Diachi] & [Tuoi] & [Yeucau]   Like ""*" & Me.Text2.Text & "*"""

    Me.List0.RowSource = strSql

End Sub
This is where the rowsource is set for the listbox


heres copy with changes
Which part of the code is "search as you type", can I have it inserted in the search box which @arnelgp modified for me? Or it's just a feature for listbox only?
 
You have to set the columns property of the listbox to show more columns
 

Users who are viewing this thread

Back
Top Bottom