Access combo box dd click to open another form problem

B

Big-dog1965

Im having a problem being able to double click on a combo box and have it
open a another form so I can enter information so the next time it will be in
the drop down.
Tables: Class Types
Fields
ClassTypeID
ClassType

Tables: Classes
Fields:
ClassID
ClassName
ClassTypeID
ClassDescription

Forms:
Classes
Class Types
My code in the Classes Form that I think should work but doesnt. What am I
missing?

Option Compare Database

Private Sub Form_Load()
If Me.OpenArgs = "GotoNew" And Not IsNull(Me![ClassID]) Then
DoCmd.DoMenuItem acFormBar, 3, 0, , acMenuVer70
End If
End Sub
Private Sub ClassTypeID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub ClassTypeID_DblClick(Cancel As Integer)
On Error GoTo Err_ClassTypeID_DblClick
Dim lngClassTypeID As Long

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

Exit_ClassTypeID_DblClick:
Exit Sub

Err_ClassTypeID_DblClick:
MsgBox Err.Description
Resume Exit_ClassTypeID_DblClick
End Sub

End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top