I would like to know if theres a possible way to show two fields in a listbox. Right now i show one field of a table in the listbox (the values showed on the listbox depend on what the user type in a textbox), but i would like to show two fields of the same table in the same listbox, for example:
I have a table called "Tools" and the fields are Code, Grade, Description, Amount, Price, Total, Location. I would like to show the fields Code and Grade in the same ListBox.
Is this possible?, If it can be done, how can i do it?
Thanks!
3 4309
I would like to know if theres a possible way to show two fields in a listbox. Right now i show one field of a table in the listbox (the values showed on the listbox depend on what the user type in a textbox), but i would like to show two fields of the same table in the same listbox, for example:
I have a table called "Tools" and the fields are Code, Grade, Description, Amount, Price, Total, Location. I would like to show the fields Code and Grade in the same ListBox.
Is this possible?, If it can be done, how can i do it?
Thanks!
1. Create a query with the two fields and set listbox Row Souce to query.
2. Set Column Count property to 2
3. Set Column Width property to e.g. 3cm;3cm
4. Make sure the Bound column property is set to the column containing the value you want stored or used.
Merry Christmas
Mary
I have a table called "Tools" and i want to modify a register of that table, for that, i need that the user "select" the register that needs to be modified. To do this, i put three text boxes (txtCode, txtGrade, txtDate) and a listbox; if i want that depending on what the user write in each one of the text boxes, the data that belongs to that criteria shows on the listbox; what should i do?
At this moment i have a code that allows me to do that but just with one textbox adn selecting the field of the table from a combo box; this is the code:
----------------------------------listbox ---------------------------------------------------------------
Private Sub lstResultado_AfterUpdate()
Dim rst As Object
On Error GoTo lstResultado_AfterUpdate_Error
Set rst = Me.Recordset.Clone
rst.FindFirst "ID = " & Me.lstResultado.Column(1)
If Not rst.NoMatch Then Me.Bookmark = rst.Bookmark
rst.Close
Set rst = Nothing
lstResultado_AfterUpdate_Salir:
On Error GoTo 0
Exit Sub
lstResultado_AfterUpdate_Error:
MsgBox "Error " & Err.Number & " en proc.: lstResultado_AfterUpdate de Documento VBA: Form_frmProveedores (" & Err.Description & ")"
GoTo lstResultado_AfterUpdate_Salir
End Sub
-------------------------------------------------------------------------------------------------------------
------------------ textbox -------------------------------------------------------------------------------
Private Sub txtBusqueda_Change()
Dim strSQL As String
strSQL = "SELECT " & Me.cmbCampo & ", ID "
strSQL = strSQL & "FROM ComprasConsumibles "
strSQL = strSQL & "WHERE [" & Me.cmbCampo & "] LIKE '*" & txtBusqueda.Text & "*'"
Me.lstResultado.RowSource = strSQL
End Sub
--------------------------------------------------------------------------------------------------------------
i have answered my doubt, the code is:
Private Sub txtCode_Change()
Dim strSQL As String
strSQL = "SELECT Codigo, Grado, ID "
strSQL = strSQL & "FROM Consumibles "
strSQL = strSQL & "WHERE [Codigo] LIKE '*" & txtCode.Text & "*'"
strSQL = strSQL & "AND [Grado] LIKE '*" & txtGrade & "*'"
Me.lstMatch.RowSource = strSQL
End Sub
---------------------------------------------------------------------------------------------------------
Private Sub txtGrade_Change()
Dim strSQL As String
strSQL = "SELECT Codigo, Grado, ID "
strSQL = strSQL & "FROM Consumibles "
strSQL = strSQL & "WHERE [Grado] LIKE '*" & txtGrade.Text & "*'"
strSQL = strSQL & "AND [Codigo] LIKE '*" & txtCode & "*'"
Me.lstMatch.RowSource = strSQL
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Heather |
last post by:
I have a Access 2000 database.
I have one table with two fields Location and Section
I have 2 list boxes on a form - one for location and one for section
Is there a way to when the user selects...
|
by: SuffrinMick |
last post by:
Hi All
I have two tables: tblRecords and tblOptions.
tblRecords consists of RecordID (autonumber), Record (text) and Option
(text record of options chosen) fields
tbloptions consists of...
|
by: Krzysztof Bartosiewicz |
last post by:
Hi!
I haven't been using Access for a very long time and I forgot everything :)
I will be very greatful for help since I have been fighting with this
problem for a few hours...
I have three...
|
by: Grant Schenck |
last post by:
Hello,
This seems like it should be easy...
I have a listbox on a .NET form.
I add a new item to the list box.
How can I associated a separate data value?
|
by: segue |
last post by:
Hi;
I need to change the order of a listbox array from a form app
where I select order up or down.
What's a good way to do that?
Regards;
Segue
|
by: filbennett |
last post by:
Hi Everyone,
I'm generally unfamiliar with Access form design, but have programmed
Cold Fusion applications for a couple of years.
I'd like to build a data entry form in Access that allows the...
|
by: metalheadstorm |
last post by:
OK i have two listboxes that are populated by data from a Access Db, its populated by a if statement sayin if the data is the same as todays date put it in list box1 and if its tomorrows date but...
|
by: Rotsey |
last post by:
Hi,
I have a listbox and I am adding objects to it with AddRange.
The problem is the listbox just shows the name of object
class in every row and not the DisplayMember see below.
Any...
|
by: JeffP |
last post by:
Just have a small problem with boolean fields in a list box showing as 0
and -1, not Yes/No or True/False.
Is there any fix to this?
--
Jeff
"More Access Stuff."
http://www.asken.com.au
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |