Re: Descriptive text in the textbox
I know this thread is marked solved, but I would love to revisit this topic. I want to accomplish this very thing. I am very new to Access and still new but somewhat less so to VB.
I implement the code above in the VB module under my form but receive the following error when I attempt to advance the form to a new record.
Run-time error '2427':
You entered an expression that has no value.
Any thoughts or advice would be appreciated.
Here's the code I used:
Private Sub Form_Current()
If Me.Account = "Select an account..." Then
Account.ForeColor = 16744448
Else
Account.ForeColor = 0
End If
End Sub
Private Sub Account_Click()
If Me.Account = "Select an account..." Then
Me.Account.SelStart = 0
Me.Account.SelLength = Len(Me.Account)
Else
Me.Account.SelStart = Nz(Len(Me.Account), 0)
End If
End Sub
Private Sub Account_GotFocus()
If Me.Account = "Select an account..." Then
Me.Account.SelStart = 0
Me.Account.SelLength = Len(Me.Account)
Else
Me.Account.SelStart = Nz(Len(Me.Account), 0)
End If
End Sub
Private Sub Account_KeyDown(KeyCode As Integer, Shift As Integer)
Account.ForeColor = 0
End Sub
I know this thread is marked solved, but I would love to revisit this topic. I want to accomplish this very thing. I am very new to Access and still new but somewhat less so to VB.
I implement the code above in the VB module under my form but receive the following error when I attempt to advance the form to a new record.
Run-time error '2427':
You entered an expression that has no value.
Any thoughts or advice would be appreciated.
Here's the code I used:
Private Sub Form_Current()
If Me.Account = "Select an account..." Then
Account.ForeColor = 16744448
Else
Account.ForeColor = 0
End If
End Sub
Private Sub Account_Click()
If Me.Account = "Select an account..." Then
Me.Account.SelStart = 0
Me.Account.SelLength = Len(Me.Account)
Else
Me.Account.SelStart = Nz(Len(Me.Account), 0)
End If
End Sub
Private Sub Account_GotFocus()
If Me.Account = "Select an account..." Then
Me.Account.SelStart = 0
Me.Account.SelLength = Len(Me.Account)
Else
Me.Account.SelStart = Nz(Len(Me.Account), 0)
End If
End Sub
Private Sub Account_KeyDown(KeyCode As Integer, Shift As Integer)
Account.ForeColor = 0
End Sub