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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-selecting the last entry in a combo-box

Status
Not open for further replies.

malbreht

Technical User
Dec 8, 2006
63
SI
Hi,

I've got a form frmSell where you enter data for a receipt...among other data you have to select the customer from a combo-box. If the customer doesn't exist, you double-click on a combo-box to open the form frmCustomer for entering a new customer.

However, when you enter the new customer and close that form, you have to find that same entry in the combo - is there any possibility that the combo would auto select the latest entry (only in case of adding the new customer, that means double-clicking...)???

Thanks to all you guys!
 
you can put the dmax function in the default property of the combox, like

=DMax("[CompanyBillID]","[tblCompanyBill]")

Pampers [afro]
Keeping it simple can be complicated
 
Sorry - I'm a newbie...could you explain a little bit more?
Should I paste that in the Properties window (where?) or in VB? At the combo I've got the code behind:

Code:
Private Sub Customer_ID_DblClick(Cancel As Integer)

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmCustomer"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

Thanks a lot!
 
It should go in the properties dialog box of the combox, at the line where it says 'default value'

Pampers [afro]
Keeping it simple can be complicated
 
Aaah, of course!

Thanks a lot! You really do keep it simple :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top