Hello All, I need some help with the back end coding for this project. I have got a picture of how I want the form to be setup and I started to write the code, but every time I get somewhere, I seem to run into a new problem. Any thoughts on how to fix. I don't mean to ask for an entire wall of code but I feel like I royally messed it up. HELP!
Code:
Sub Reset()
Dim iRow As Long
iRow = [Counta(Database!A:A] ' identifying the last row
With frmForm
.txtdate = ""
.txtlocation = ""
.Txtturnedin = ""
.txtturnedinby = ""
.txtowner = ""
.OptionButton1 = False
.OptionButton2 = False
.OptionButton3 = False
.OptionButton4 = False
.OptionButton5 = False
.OptionButton6 = False
.OptionButton8 = False
.OptionButton7 = False
.Txtbrand = ""
.txtmodel = ""
.txtcolor = ""
.OptionButton9 = False
.OptionButton10 = False
.OptionButton11 = False
.txtdescription = ""
.lstDatabase.ColumnCount = 11
.lstDatabase.ColumnCount = True
.lstDatabase.ColumnWidths = "50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 250"
If iRow > 1 Then
.lstDatabase.RowSource = "Database!A@:I" & iRow
Else
.lstDatabase.RowSource = "database!A2:I2"
End If
End With
End Sub
Sub Submit()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("database")
iRow = [Counta(Database!A:A)] + 1
With sh
.Cells(iRow, 1) = iRow - 1
.Cells(iRow, 2) = frmForm.txtdate.Value
.Cells(iRow, 3) = frmForm.txtlocation.Value
.Cells(iRow, 4) = frmForm.Txtturnedin.Value
.Cells(iRow, 5) = frmForm.txtturnedinby.Value
.Cells(iRow, 6) = frmForm.txtowner.Value
.Cells(iRow, 7) = IIf(frmForm.OptionButton1.Value = True, "electronics", "wallet/purse", "medical devices", "jewelry", "clothing", "keys", "Identifications", "Other")
.Cells(iRow, 8) = frmForm.Txtbrand.Value
.Cells(iRow, 9) = frmForm.txtmodel.Value
.Cells(iRow, 10) = frmForm.txtcolor.Value
.Cells(iRow, 11) = frmForm.OptionButton9.Value = True
.Cells(iRow, 12) = fromform.txtdescription.Value
.Cells(iRow, 13) = Application.UserName
.Cells(iRow, 13) = [text(now(),"DD-MM-YYYY HH:MM:SS")]
End With
End Sub