making a text/combo box memorize last record

S

sushi155

Hey I have a quick question. I have a form where the user can enter th
company's name, and then all the specs on one of their products. The
then press enter and the whole thing is put into a table.

Here is the problem. I want some of the fields to stay the same. Fo
example, if i entered companyX as the company name and entered in on
of their product's information I don't want to have to put in thei
name again when i am putting in one of their many other products. Doe
anyone know how to do this
 
T

tynerr

Yup, easy.

Set the default value of the control to the current value on the afterupdate
event.

Forms!frmInvoice!PaymentMethod.DefaultValue =
Forms!frmInvoice!PaymentMethod.Value

jim at andersonsoftware dot ca
 
J

John Vinson

Hey I have a quick question. I have a form where the user can enter the
company's name, and then all the specs on one of their products. They
then press enter and the whole thing is put into a table.

Here is the problem. I want some of the fields to stay the same. For
example, if i entered companyX as the company name and entered in one
of their product's information I don't want to have to put in their
name again when i am putting in one of their many other products. Does
anyone know how to do this?

You can put code in the combo box's AfterUpdate event. Let's say the
combo is named cboCompany; view its properties, on the Events tab
select the AfterUpdate event, and click the ... icon by it. Choose the
Code Builder option and enter the following (Access will have put in
the Sub and End Sub lines):

Private Sub cboCompany_AfterUpdate()
Me!cboCompany.DefaultValue = Chr(34) & Me!cboCompany & Chr(34)
End Sub


John W. Vinson[MVP]
 
Top