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

unbound combo finding proper record

Status
Not open for further replies.

cabbey77

Technical User
Aug 6, 2004
68
US
Okay,

I have 1 form with 2 subforms. I have an unbound combo box in the header that is designed to find a record on the form. If the item is not in list, the form should go to a new record and when the combo box loses focus it should go blank.

I have 3 different code events and they are either conflicting or not working and im not sure how/where to combine them to get the above effect.

Here is the code.

Private Sub Combo23_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Me.DataEntry = False ( the form is set to data entry on open so that it is blank)
Set rs = Me.Recordset.Clone
rs.FindFirst "[PartNum] = '" & Me![Combo23] & "'"
Me.Bookmark = rs.Bookmark
End Sub


Private Sub Combo23_NotInList(NewData As String, Response As Integer)
Dim rs As Object
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub PartNum_GotFocus()
Me![Combo23] = Null
End Sub
 
How arebya cabbey . . .
cabbey said:
[blue]If the item is not in list . . .[/blue]
This is what the [blue]NotInList[/blue] event is for! (aka the proper way to add values to the list!).

[blue]Look it up[/blue] in vbe help to get the skinny! . . .

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top