Good afternoon, I am trying to transfer information from my Excel User Form into the database table. After searching vigourously on the internet, I came across this formula to find the next empty row:
I have the formula for transfering the information into the table:
And for emptying the User Form:
I cut and paste this formula into my VBA program; however I receive the following error:
Run-Time error '1004'
Application-defined or object-defined error
My question is what am I not seeing in this formula?
Code:
Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("DocumentFiled") 'Find First Empty Row in Database iRow = ws.Cells(Rows.Count, 1).End(x1Up).Offset(1, 0).Row
Code:
'Copy the data to the database ws.Cells(iRow, 1).Value = frmDocument.DateCompleted.Value ws.Cells(iRow, 2).Value = frmDocument.CaseNumber.Value ws.Cells(iRow, 3).Value = frmDocument.coboDocTypes.Value ws.Cells(iRow, 4).Value = frmDocument.DateFiled.Value ws.Cells(iRow, 5).Value = frmDocument.coboNames.Value
Code:
'Clear the data for next entry frmDocument.DateCompleted.Value = "" frmDocument.CaseNumber.Value = "" frmDocument.coboDocTypes.Value = "" frmDocument.DateFiled.Value = "" frmDocument.coboNames.Value = "" End Sub
Run-Time error '1004'
Application-defined or object-defined error
My question is what am I not seeing in this formula?
Comment