
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:
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:
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:
Option Compare Database
Private Sub Command1_Click()
Dim a As Long
For a = 0 To 6
Me("Text" & a) = "Text Box # " & a
Next a
End Sub
This code assumes that you have seven (7) text boxes Named Text0 through Text6.