I may be asking for a lot here but any help would be greatly appreciated!
Currently i have a form like this: (see below screenshot)
the user enters data, and then it goes into the database at the bottom of the page.
However i want to take this database that's at the bottom and put it on a second form (userform2) But i am unsure how to link the data to the new userform.
Currently the code to do this looks like this: (lstDatabase is the listbox at the bottom in which the data is displayed in the database)
code is then entered to a worksheet "database"
Currently i have a form like this: (see below screenshot)
the user enters data, and then it goes into the database at the bottom of the page.
However i want to take this database that's at the bottom and put it on a second form (userform2) But i am unsure how to link the data to the new userform.
Currently the code to do this looks like this: (lstDatabase is the listbox at the bottom in which the data is displayed in the database)
VBA Code:.lstDatabase.ColumnCount = 14 .lstDatabase.ColumnHeads = True .lstDatabase.ColumnWidths = "30,60,75,40,60,45,55,70,70" If iRow > 1 Then .lstDatabase.RowSource = "Database!A2:N" & iRow Else .lstDatabase.RowSource = "Database!A2:N2" End If
code is then entered to a worksheet "database"
VBA Code:
'code for submitting data to database
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Database")
If frmForm.txtRowNumber.Value = "" Then
iRow = [Counta(Database!A:A)] + 1
Else
iRow = frmForm.txtRowNumber.Value
End If
With sh
'adding each row to database
.Cells(iRow, 1) = "=Row()-1" 'Dynamic Serial Number
.Cells(iRow, 2) = frmForm.ComboBox1.Value
.Cells(iRow, 3) = frmForm.txtName.Value
.Cells(iRow, 4) = frmForm.txtID.Value
.Cells(iRow, 5) = frmForm.txtCity.Value
.Cells(iRow, 6) = frmForm.TextBox1.Value
.Cells(iRow, 7) = frmForm.TextBox4.Value
.Cells(iRow, 8) = frmForm.TextBox5.Value
.Cells(iRow, 9) = frmForm.TextBox6.Value
.Cells(iRow, 10) = frmForm.TextBox7.Value
.Cells(iRow, 11) = frmForm.TextBox8.Value
.Cells(iRow, 12) = frmForm.TextBox9.Value
.Cells(iRow, 13) = frmForm.TextBox10.Value
.Cells(iRow, 14) = frmForm.TextBox11.Value
.Cells(iRow, 15) = Application.UserName
.Cells(iRow, 16) = [Text(Now(), "DD-MM-YYYY HH:MM:SS")]
End With