retain previous value error

L

Linda

I have a form with two combo boxes on. I would like to default the value for
both of the combo boxes to the last value entered. I have put code in the
LostFocus event for each to retain the value entered. When I go to the next
record for input, the cboLocation is retained and displayed as the default
but the cboProgram is not. Instead for cboProgram I get the error #Name?
Can someone help me identify the difference between the two?

On the same form I have a text box that I also want to retain the value as
the default for the next record (txtCAN). This is bound to a text field in a
table and can consist of numbers and/or letters. When I enter 0907 in the
text box, the next record shows the default value of 907 dropping the leading
zero. The field is defined as text and not numeric so it should not be
dropping the leading zero. How do I fix the dropped leading zero?

Any help would be appreciated. Linda

Private Sub cboLocation_LostFocus()
Const cQuote = ""
Me!cboLocation.DefaultValue = cQuote & Me!cboLocation.Value & cQuote

End Sub

Private Sub cboProgram_LostFocus()
Const cQuote = ""
Me!cboProgram.DefaultValue = cQuote & Me!cboProgram.Value & cQuote

Me!cboBudgetLine.Requery
Me!cboBudgetLine.SetFocus
End Sub

Private Sub txtCAN_LostFocus()
Const cQuote = ""
Me!txtCAN.DefaultValue = cQuote & Me!txtCAN.Value & cQuote
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