combo box find record and more

P

Piers

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.
 
T

Treebeard

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
 

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