Quote Originally Posted by vonoventwin
I have a txtbox called txtDate and I want to populate it with the current date. Something like this but it's not working
VB Code:
  1. Me.txtDate.Text = Format(Now, "dddd, mmm d yyyy, hh:mm AMPM")

I have also found that using the ".Text" Property when assigning data to a text box causes problem. This should work for you:

VB Code:
  1. Me.txtDate = Format(Now, "dddd, mmm d yyyy, hh:mm AMPM")

Also if you have multiple text boxes and you want to refer to them in a kind of control array you can do this:

VB Code:
  1. Option Compare Database
  2.  
  3. Private Sub Command1_Click()
  4. Dim a As Long
  5.  
  6.     For a = 0 To 6
  7.         Me("Text" & a) = "Text Box # " & a
  8.     Next a
  9. End Sub

This code assumes that you have seven (7) text boxes Named Text0 through Text6.