I have created an excel database, it in involves the following userform:
The database user fills this form in and then data is transferred to the sheet "database" using the following:
I have now added a checklist at the bottom of the form, see above form image. How can i capture whether this box is ticked or not and then produce a YES or NO on iRow 21 (next available column) of the database sheet.
Is it possible to give the checkbox a value i.e if ticked then YES then just put for example ".Cells(iRow, 21) = frmForm.Checkbox1.Value"
End Sub[/CODE]
The database user fills this form in and then data is transferred to the sheet "database" using the following:
Code:
[CODE=vba]Sub Submit()
'code for submitting data to database
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Database")
'finds first available blank row in database to add data to
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, iRow is column in Database
'Be sure to add any new columns to the below
.Cells(iRow, 1) = "=Row()-1" 'Dynamic Serial Number
.Cells(iRow, 2) = frmForm.ModelNo.Value
.Cells(iRow, 3) = frmForm.PartNo.Value
.Cells(iRow, 4) = frmForm.WorksOrderNo.Value
.Cells(iRow, 5) = frmForm.SerialNo.Value
.Cells(iRow, 6) = frmForm.MaterialNo.Value
.Cells(iRow, 7) = frmForm.SerialNumber.Value
.Cells(iRow, 8) = frmForm.txtType.Value
.Cells(iRow, 9) = frmForm.txtSize.Value
.Cells(iRow, 10) = frmForm.txtWKPRESS.Value
.Cells(iRow, 11) = frmForm.txtCertDate.Value
.Cells(iRow, 12) = frmForm.BatchNo.Value
.Cells(iRow, 13) = frmForm.JobNo.Value
.Cells(iRow, 14) = frmForm.DateOfManufacture.Value
.Cells(iRow, 15) = frmForm.Label47.Caption
.Cells(iRow, 16) = Application.UserName
.Cells(iRow, 17) = [Text(Now(), "DD-MM-YYYY HH:MM:SS")]
.Cells(iRow, 18) = frmForm.TextBox25.Value
.Cells(iRow, 19) = frmForm.Certificate.Value
.Cells(iRow, 20) = frmForm.BarRating.Value
End With
I have now added a checklist at the bottom of the form, see above form image. How can i capture whether this box is ticked or not and then produce a YES or NO on iRow 21 (next available column) of the database sheet.
Is it possible to give the checkbox a value i.e if ticked then YES then just put for example ".Cells(iRow, 21) = frmForm.Checkbox1.Value"
End Sub[/CODE]