Hi,
I'm a newbie to programming in VB and Access 2010, so please bear with me:
I have 4 fields (Prefix, JournalName, Subtitle, Edition) in table z_tbl_journals that, concatenated together, needs to be searched with a combo box. If the user types in say, Afri, the results need to include all records that contain that string in any of the 4 fields, not just start with it. The string can occur anywhere in the 4 fields.
Again, I am very new to Access and VBA, although an old RPG programmer, so I'm trying to figure this all out and really could use some help.
The form name is z_frm_tabbed and the combo box is called Combo123.
Row Source:
SELECT z_tbl_journals.JournalID, Trim([Prefix] & " " & [JournalName] & " " & [Subtitle] & " " & [Edition]) AS Expr1 FROM z_tbl_journals INNER JOIN z_tbl_journals_by_product ON z_tbl_journals.JournalID = z_tbl_journals_by_product.JournalID WHERE ((([Expr1]) Like "*" & [forms]![z_frm_tabbed]![Combo123] & "*")) ORDER BY Trim([Prefix] & " " & [JournalName] & " " & [Subtitle] & " " & [Edition]);
Row Source Type: Table/Query
Bound Column: 1
Limit To List: Yes
On Change: [Event Procedure]
VB Code:
Private Sub Combo123_Change()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Expr1] = " & Str(Nz(Me![Combo123], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Form_Open(Cancel As Integer)
' Set Focus to Journal Name Combo Box
Combo123.SetFocus
End Sub
What I have so far is me reaching to make it work without fully understanding all of it, but I'm trying. As it sits, a parameter box for Expr1 pop-ups as soon as a character is typed in the combo box and then it aborts.
Any help as it how to make this work is greatly appreciated and will help me to learn more. Please spell out in detail what I need to do, assuming I don't know Access 2010 or VBA hardly at all. :banghead:
I'm a newbie to programming in VB and Access 2010, so please bear with me:
I have 4 fields (Prefix, JournalName, Subtitle, Edition) in table z_tbl_journals that, concatenated together, needs to be searched with a combo box. If the user types in say, Afri, the results need to include all records that contain that string in any of the 4 fields, not just start with it. The string can occur anywhere in the 4 fields.
Again, I am very new to Access and VBA, although an old RPG programmer, so I'm trying to figure this all out and really could use some help.
The form name is z_frm_tabbed and the combo box is called Combo123.
Row Source:
SELECT z_tbl_journals.JournalID, Trim([Prefix] & " " & [JournalName] & " " & [Subtitle] & " " & [Edition]) AS Expr1 FROM z_tbl_journals INNER JOIN z_tbl_journals_by_product ON z_tbl_journals.JournalID = z_tbl_journals_by_product.JournalID WHERE ((([Expr1]) Like "*" & [forms]![z_frm_tabbed]![Combo123] & "*")) ORDER BY Trim([Prefix] & " " & [JournalName] & " " & [Subtitle] & " " & [Edition]);
Row Source Type: Table/Query
Bound Column: 1
Limit To List: Yes
On Change: [Event Procedure]
VB Code:
Private Sub Combo123_Change()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Expr1] = " & Str(Nz(Me![Combo123], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Form_Open(Cancel As Integer)
' Set Focus to Journal Name Combo Box
Combo123.SetFocus
End Sub
What I have so far is me reaching to make it work without fully understanding all of it, but I'm trying. As it sits, a parameter box for Expr1 pop-ups as soon as a character is typed in the combo box and then it aborts.
Any help as it how to make this work is greatly appreciated and will help me to learn more. Please spell out in detail what I need to do, assuming I don't know Access 2010 or VBA hardly at all. :banghead:
Last edited: