HELP! add new record to combo box recordset in a subform

  • Thread starter Thread starter lisa
  • Start date Start date
L

lisa

What is the coding to add a record to a table underlying a
combo box in a subform so that it appears.

I have tried DblClick as below but get the following
msg: "object doesn't support this property or method".
What am I doing wrong??


Private Sub Type_of_Link_DblClick(Cancel As Integer)
On Error GoTo Err_LinkTypeID_DblClick
Dim lngLinkTypeID As Long

If IsNull(Me![LinkTypeID]) Then
Me![LinkTypeID].Text = ""
Else
lngLinkTypeID = Me![LinkTypeID]
Me![LinkTypeID] = Null
End If
DoCmd.OpenForm "Link Types", , , , , acDialog, "GotoNew"
Me![LinkTypeID].Requery
If lngLinkTypeID <> 0 Then Me![LinkTypeID] =
lngLinkTypeID

Exit_LinkTypeID_DblClick:
Exit Sub

Err_LinkTypeID_DblClick:
MsgBox Err.Description
Resume Exit_LinkTypeID_DblClick
End Sub
 
You are close. Here is the code for both the events you
spoke about. Just change to match your values.



Private Sub SupplierID_DblClick(Cancel As Integer)
On Error GoTo Err_SupplierID_DblClick
Dim lngRequestID As Long

If IsNull(Me![SupplierID]) Then
Me![SupplierID].Text = ""
Else
lngRequestID = Me![SupplierID]
Me![SupplierID] = Null
End If
DoCmd.OpenForm "Suppliers", , , , , acDialog, "GotoNew"
Me![SupplierID].Requery
If lngRequestID <> 0 Then Me![SupplierID] =
lngRequestID

Exit_SupplierID_DblClick:
Exit Sub

Err_SupplierID_DblClick:
MsgBox Err.Description
Resume Exit_SupplierID_DblClick
End Sub

Private Sub SupplierID_NotInList(NewData As String,
Response As Integer)
MsgBox "Double-click this field to add an entry to the
list."
Response = acDataErrContinue
End Sub


Have a great Sunday :),
Becky
 
Back
Top