Pass New Value from NotinList

cjman

Registered User.
Local time
Today, 05:39
Joined
Mar 4, 2009
Messages
28
I am trying to pass a new description into the Products form. So the users no not need to type the description twice. The user then also adds a category. It works when I am not trying to pass the value. I think the problem is that the new entry is not saved in the text box.

Private Sub Description_NotInList(NewData As String, Response As Integer)
Dim MsgAnsr As Variant
Dim strNewDescription As String
Response = acDataErrContinue
MsgAnsr = MsgBox("Do you want to add this new product?", vbYesNo)
If MsgAnsr = vbNo Then
Me.Description.SetFocus
Me.Description = ""
Else
:confused:strNewDescription = Me.Description.Value
:confused:DoCmd.OpenForm"dbo_ProductsVW" , , , "[strNewDescription]=" & [Me.PDescription], acFormAdd, acDialog

Response = acDataErrAdded
End If
End Sub
 
What version of Access are you using. The reason I ask is for Access 2007 and 2010 you don't need any code at all to do this.
 
I am using 2010. Sorry about not mentioning that.
 
in that case you just need a form which will be able to add the details of the record and then in the combo box's properties there is a property that is called something like Edit List form which you then set to that form. Once you do that, all is taken care of. You need to do nothing more.
 

Users who are viewing this thread

Back
Top Bottom