how to display data from a database in a form view

jbrom

New member
Joined
Jul 18, 2018
Messages
3
Reaction score
0
Points
0
Excel Version(s)
2010
Hi

i currently have a data base which is approx 150 rows by 30 columns, I want to be able to display any one row in a form view. i know that i can do this by adding the "Forms" tab the ribbon, but i want (if possible) to be able either have a button next to the row or click on the entry to display it in a form view. not sure if this needs to be done with macros? (if it is a button, it needs to be locked to the row as the data can be filtered to meet different criteria.

can anyone help?

thanks
 
.
Here is an example to get you started :


Code:
Option Explicit


Private Sub UserForm_Initialize()
'Macro Purpose: To populate a multi-column listbox with data from
'               a worksheet range


    Dim sn, i As Long
    
    'Define the range you want to use
    With Sheets("Sheet1").Cells(1).CurrentRegion
        sn = .Offset(1).Value
        For i = 1 To UBound(sn, 2)
            Me("Label" & i).Caption = Application.Index(.Value, 1, i)
        Next
    End With
    
    'Place the array in the listbox
    With ListBox1
        .ColumnCount = 3
        .ColumnWidths = "50;80;100"
        .List = sn
    End With
End Sub


Private Sub cmdCancel_Click()
    Unload Me
End Sub

[
 

Attachments

  • multicollistbox2.xls
    45.5 KB · Views: 19
Thanks for your reply and the attached example. this is really helpful.

however, is there a way of having, for example row 1's data displayed so when cell a1 (being the name) is clicked, it opens only the data in that row (similar to when the forms view is clicked in the ribbon) rather than a button that displays all data?
 
You can simply use vlookup formula to create data forms. Check out example sheet.
 

Attachments

  • Form view.xlsx
    9.6 KB · Views: 12
Is this what you are looking for? Doubleclick in the row you want
 

Attachments

  • multicollistbox.xlsb
    22.8 KB · Views: 12
Back
Top