Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default name not automatic 1

Status
Not open for further replies.

MrsTFB

MIS
Oct 3, 2000
307
US
Can I have a default name not be automatic? I want one particular name to come up in a field, but not be there unless the user enters at least the one letter. Like a list but with just the one value.

Does this make since, just reply if I need to explain this better.

Thanks,

Bsimm

GO TITANS!
 
why not use a combobox on the form instead of a textbox. Use ValueList as the RowSourceType, enter the one value you want as the default in the RowSource, set LimitToList to No, and the ControlSource to the Field you want to update.

PaulF
 
PaulF,
I was trying to bother someone else for awhile. You are too helpful. I'm going to try that, but I didn't really want those arrows on the side of the box. Is that being female or what. I wanted a regular looking box. Is that doable?
Did you recognize my name? or the GO TITANS!

 
Beth

Honestly, I didn't notice who posted the question, and if I had, I still would have answered it.

Try this one, set the Form's Key Preview Event to Yes, change Text0 to the name of the TextBox you want to test, change VbKeyM to the Key you want to test for, and change = "MyDefault" to the default value you want to use.

Works most of the time.... if you start changing the text back and forth without moving out of the textbox it won't work, but if you don't start making too many changes it does what you want it to.

Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
If IsNull(Text0.Text) Or Text0.Text = "" Or Text0.Text = " " Then
If KeyCode = vbKeyM Then ' for the keyM
KeyCode = 0
Text0.Value = "MyDefault"
End If
End If
End Sub


PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top