G
Guest
I am try to create code to respond to the Not on list event.
the following code is from Evan Callahan's book Access2000 Visual Basic for
Applications.
Private Sub Fabric_NotInList(NewData As String, Response As Integer)
'Ask user if want to add new fabric to list
Dim strMessage As String
Dim dbsSoftGoodsOrders As Database
Dim rstTypes As DAO.Recordset
strMessage = "Are you sure you want to add '" & NewData & "'to the list of
fabrics?"
If Confirm(strMessage) Then
'Open the Fabrics Table and add the NewData Value.
Set dbsSoftGoodsOrders = CurrentDb
Set rstTypes = dbsSoftGoodsOrders.OpenRecordset("Fabrics")
rstTypes.AddNew
rstTypes!FabricID = NewData
rstTypes.Update
Response = acDataErrAdded 'Requery the list
Else
Response = acDataErrDisplay 'Display the error
End If
End Sub
My problem is that before I can enter a new Fabric I must first enter its
(new) pattern name. I seem to recall there was another version of the above
code that would open a data entry form so I could fill in all the required
info.
Any suggestions are greatly appreciated.
the following code is from Evan Callahan's book Access2000 Visual Basic for
Applications.
Private Sub Fabric_NotInList(NewData As String, Response As Integer)
'Ask user if want to add new fabric to list
Dim strMessage As String
Dim dbsSoftGoodsOrders As Database
Dim rstTypes As DAO.Recordset
strMessage = "Are you sure you want to add '" & NewData & "'to the list of
fabrics?"
If Confirm(strMessage) Then
'Open the Fabrics Table and add the NewData Value.
Set dbsSoftGoodsOrders = CurrentDb
Set rstTypes = dbsSoftGoodsOrders.OpenRecordset("Fabrics")
rstTypes.AddNew
rstTypes!FabricID = NewData
rstTypes.Update
Response = acDataErrAdded 'Requery the list
Else
Response = acDataErrDisplay 'Display the error
End If
End Sub
My problem is that before I can enter a new Fabric I must first enter its
(new) pattern name. I seem to recall there was another version of the above
code that would open a data entry form so I could fill in all the required
info.
Any suggestions are greatly appreciated.