Invalid qualifier with dates

B

Basta1980

Hi all,

Trying to create an userform. I'm testing if the userform works
accordingley, needless to say it doesn't. Below is the code I use. Thing is I
always get an 'invalid qualifier' when it comes ot fields containing dates
(i.e. tbCreationDate). What do I have to do get these dates working?!

Private Sub CommandButton2_Click()

Dim tbCreationDate As Date
Dim TB2ndcheck As Date
Dim tbFinConDate As Date
Dim tbMgt As Date
Dim tbRetour As Date
Dim tbGroup As Date
Dim tbCFOCEO As Date
Dim tbRetourCompleet As Date
Dim tbVerwerktSystemen As Date

'Determine next empty line

NewRow = Worksheets("Operational Credit").Range("A20000").End(xlUp).Row
+ 1

'Fill in data

Worksheets("Operational Credit").Cells(NewRow, 1).Value =
tbAanvrager.Value
Worksheets("Operational Credit").Cells(NewRow, 2).Value =
tbVeroorzaker.Value
Worksheets("Operational Credit").Cells(NewRow, 3).Value = tbMinuten.Value
Worksheets("Operational Credit").Cells(NewRow, 4).Value = tbBedrijf.Value
Worksheets("Operational Credit").Cells(NewRow, 5).Value = tbBan.Value
Worksheets("Operational Credit").Cells(NewRow, 6).Value = tbBedrag.Value
Worksheets("Operational Credit").Cells(NewRow, 7).Value = tbCreationDate
Worksheets("Operational Credit").Cells(NewRow, 8).Value = cbOorzaak.Value
Worksheets("Operational Credit").Cells(NewRow, 9).Value =
tbCorrectieActie.Text
Worksheets("Operational Credit").Cells(NewRow, 10).Value = cbCheckFC.Value
Worksheets("Operational Credit").Cells(NewRow, 11).Value =
TB2ndcheck.Value
Worksheets("Operational Credit").Cells(NewRow, 12).Value =
tbFinConDate.Value
Worksheets("Operational Credit").Cells(NewRow, 13).Value = tbMgt.Value
Worksheets("Operational Credit").Cells(NewRow, 14).Value = tbRetour.Value
Worksheets("Operational Credit").Cells(NewRow, 15).Value = tbGroup.Value
Worksheets("Operational Credit").Cells(NewRow, 16).Value = tbCFOCEO.Value
Worksheets("Operational Credit").Cells(NewRow, 17).Value =
tbRetourCompleet.Value
Worksheets("Operational Credit").Cells(NewRow, 18).Value =
tbVerwerktSystemen.Value
Worksheets("Operational Credit").Cells(NewRow, 18).Value =
tbOpmerkingFC.Text

tbAanvrager.SetFocus
End Sub


Regards,

Basta
 
D

Dave Peterson

What is tbCreationDate?

Is it a variable (and where do you modify it???)

Or is it an object (a textbox???) on that userform?

If it's an object on the userform, delete the Dim statement. And try using
tbcreationdata.value in your assignment (like the other assignments).
 
B

Basta1980

Dave,

tbCreationDate was indeed an object. I deleted the statements. I think the
most logical option to make sure the dates are treated as dates is to tell
vba to alter the format cells to date?! Or is there a prettier way.

By the way, other question. How can I add the possibility to search for two
topics. The code below gives me the chance to look for one topic.

Private Sub CommandButton1_Click()
With Worksheets("Sheet3").Range("C1:C14")
Set c = .Find(TextBox1.Text, LookIn:=xlValues)
firstAddress = c.Address
Range(firstAddress).Select

End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top