I have a sub form to which the tables have referential integrity checked.
There are two PKs in this sub form that i need to update on the fly.
the relationship is as follows:
Refrigeranttype,RefrigerantID(pk) 1-~ Cylinderserialno(pk), RefrigerantID(Fk), Tareweight, netqty
When i add a new cylinder on my subform at present i get a runtime error as it requires a record in the refrigerant table to to RefInteg
Could somebody help me extend the code so that on adding a new cylinder it immediately asks to pick the refrigerant that the cylinder contains and inturn holds up on ref integ without error. It would be helpful if this can pull up a combo box if possible as its a predefined list.
Code at present:
Private Sub Combo8_NotInList(NewData As String, Response As Integer)
'Get confirmation that this is not just a spelling error.
StrTmp = "Add '" & NewData & "' As a new cylinder?"
If MsgBox(StrTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then
'Append the NewData as a record in the Categories table.
StrTmp = "INSERT INTO Cylinders ( CylinderSerialNo ) " & _
"SELECT """ & NewData & """ AS CylinderSerialNo;"
DBEngine(0)(0).Execute StrTmp, dbFailOnError
'Notify Access about the new record, so it requeries the combo.
Response = acDataErrAdded
There are two PKs in this sub form that i need to update on the fly.
the relationship is as follows:
Refrigeranttype,RefrigerantID(pk) 1-~ Cylinderserialno(pk), RefrigerantID(Fk), Tareweight, netqty
When i add a new cylinder on my subform at present i get a runtime error as it requires a record in the refrigerant table to to RefInteg
Could somebody help me extend the code so that on adding a new cylinder it immediately asks to pick the refrigerant that the cylinder contains and inturn holds up on ref integ without error. It would be helpful if this can pull up a combo box if possible as its a predefined list.
Code at present:
Private Sub Combo8_NotInList(NewData As String, Response As Integer)
'Get confirmation that this is not just a spelling error.
StrTmp = "Add '" & NewData & "' As a new cylinder?"
If MsgBox(StrTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then
'Append the NewData as a record in the Categories table.
StrTmp = "INSERT INTO Cylinders ( CylinderSerialNo ) " & _
"SELECT """ & NewData & """ AS CylinderSerialNo;"
DBEngine(0)(0).Execute StrTmp, dbFailOnError
'Notify Access about the new record, so it requeries the combo.
Response = acDataErrAdded