Combo box delete

A

Anneg

Hello
I have a combo box which finds a record on my form based on the value I
selected in my combo box. Once the record is found, I would like the combo
box to go blank again. I'd really appreciate any help.
Many thanks in advance.
Anne
 
A

Anneg

Further to my previous post, I should say that the form is unbound and this
is the code for the combo box (I'm using Access 2003):

Private Sub Combo100_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo100], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Many thanks.
Anne
 
J

Jeanette Cunningham

Anne,
it's a bit tricky because you have code that launches every time there is a
change in the value of the combo box.
If you set the combo box to null in code it might work but it might not. If
you want to try it here is some code.

Private Sub Combo100_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo100], 0))
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
me.Combo100 = Null
End If
Set rs = Nothing
End Sub

Jeanette Cunningham

Anneg said:
Further to my previous post, I should say that the form is unbound and
this
is the code for the combo box (I'm using Access 2003):

Private Sub Combo100_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo100], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Many thanks.
Anne

Anneg said:
Hello
I have a combo box which finds a record on my form based on the value I
selected in my combo box. Once the record is found, I would like the
combo
box to go blank again. I'd really appreciate any help.
Many thanks in advance.
Anne
 
A

Anneg

Jeanette
You are brilliant. It worked.
Many thanks for helping me again.
Best
Anne

Jeanette Cunningham said:
Anne,
it's a bit tricky because you have code that launches every time there is a
change in the value of the combo box.
If you set the combo box to null in code it might work but it might not. If
you want to try it here is some code.

Private Sub Combo100_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo100], 0))
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
me.Combo100 = Null
End If
Set rs = Nothing
End Sub

Jeanette Cunningham

Anneg said:
Further to my previous post, I should say that the form is unbound and
this
is the code for the combo box (I'm using Access 2003):

Private Sub Combo100_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo100], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Many thanks.
Anne

Anneg said:
Hello
I have a combo box which finds a record on my form based on the value I
selected in my combo box. Once the record is found, I would like the
combo
box to go blank again. I'd really appreciate any help.
Many thanks in advance.
Anne
 

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