Have a combobox that I don't want to act like a Combobox

Code:
Private Sub InventoryDepartmentNumber_BeforeUpdate(Cancel As Integer)
 If DCount("*", "tblDept", "InventoryDepartmentNumber=" & Me.InventoryDepartmentNumber) = 0 Then
    If MsgBox("This Inventory Department Number does not exist.  Do you wish to add it?", vbQuestion + vbYesNo, "Add Department Number?") = vbYes Then
        Forms!frmAddDepartment.InventoryDepartmentNumber = frmInput.InventoryDepartmentNumber
        DoCmd.OpenForm "frmAddDepartment", DataMode:=acFormAdd, WindowMode:=acWindowNormal

    Else
        Cancel = True
        Me.InventoryDepartmentNumber.Undo
   End If
End If
End Sub

this doesn't work even though i don't expect it to but I want you to see what I have..I'm not seeing what you mean i dont think
 
this doesn't work even though i don't expect it to but I want you to see what I have..I'm not seeing what you mean i dont think
What do you mean it doesn't work? It should check to see if it already exists and not do anything if it does but open the form for adding if it does not exist.

So the line you would need to add just below the DoCmd.OpenForm part is

Code:
Forms!frmAddDepartment.InventoryDepartmentNumber = Me.InventoryDepartmentNumber
 
ahh I was putting it on the wrong line...that works...silly me.

Thanks Bob!
 

Users who are viewing this thread

Back
Top Bottom