combo box find record and more

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi folks,

Have a combo box used as a go-to-record. This is populated from another form, which means there may be options in the drop-down for records that haven't yet been created.

I want to be able to choose an option from the drop-down to go to a record. If there's no match, then create a new record and insert the option chosen into another field on the form.

Can anyone point me in the right direction please?

Thanks in advance,

Piers.
 
Piers said:
Hi folks,

Have a combo box used as a go-to-record. This is populated from another
form, which means there may be options in the drop-down for records that
haven't yet been created.
I want to be able to choose an option from the drop-down to go to a
record. If there's no match, then create a new record and insert the option
chosen into another field on the form.
Can anyone point me in the right direction please?

Thanks in advance,

Piers.

Put this in the "After Update" event of your combo box.

Dim StrCriteria As String, TheChosenInvoiceNumber As Long
TheChosenInvoiceNumber = Me.InvoiceComboBox

StrCriteria = "[InvoiceNumber] = " & TheChosenInvoiceNumber
Me.RecordsetClone.FindFirst StrCriteria

If Me.RecordsetClone.NoMatch Then
DoCmd.GoToRecord , , acNewRec
Me.InvoiceNumber = TheChosenInvoiceNumber
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
 
Back
Top