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

setting combox default to null

Status
Not open for further replies.

newbieone

Technical User
Jan 3, 2006
50
US
I have a combo box on a form called last name. I can pick people from the combo box which brings up that user and all their information. however, when I try and add a new record the combo box retains that last user I looked at. how do I set this combo box to default to null on a new record?
 
In the Current event procedure of the form you may try something like this:
If Me.NewRecord Then
Me![combo name] = Null
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
apparently when I used the combo box wizard it added code to the after update event.

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[Last Name] = '" & Me![Combo33] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

How do I get this code to work but still give me the null value for a new record?
 
In my previous post replace [combo name] with [Combo33].

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I think I need to clarify.... the me.[combo33].value=null works in both places. what is not working correctly is the fact that when I enter something into the combo box then hit a key, the recordset code updates the rest of the fields with infomation that is supposed to be null unless selected from the combo box. How do I keep all fields null but still have the combo box work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top