R
RichG
I am running into a problem when trying to open a form by double-clicking on
a combo-box within Access.
I have a form named “Applications†that has (among other objects) a
combo-box named “Support_Goup_Name†that links to a field called
“Support_Goup_Name†within table called “Support_Groupsâ€. I also have a
separate form named “Support_Groups†that displays a combo-box named
“Support_Goup_Nameâ€.
The Applications form is used to add applications and support groups to a
given system, and I need to be able to choose either from an existing support
group (this works now), or add a new support group on demand (does not yet
work).
I am trying to make use of the “DblClick†and “DoCmd.OpenForm†functions to
allow a user to double-click on the “Support_Goup_Name†combo-box to
dynamically create a new record as required. After searching for code
examples, I found a code snippet on the Microsoft site. I then altered the
snippet with what I thought might be the appropriate modifications as follows…
Private Sub Support_Group_Name_DblClick(Cancel As Integer)
Dim lngSupport_Group As Long
If IsNull(Me![Support_Group_Name]) Then
Me![Support_Group_Name].Text = ""
Else
lngSupport_Group = Me![Support_Group_Name]
Me![Support_Group_Name] = Null
End If
DoCmd.OpenForm "Support_Groups", , , , , acDialog, "GotoNew"
Me![Support_Group_Name].Requery
If lngSupport_Group <> 0 Then Me![Support_Group_Name] = lngSupport_Group
End Sub
When I double-click on the combo-box after entering this snippet, the system
displays the following error dialogue box…
Run-time error '13':
Type mismatch
When I launch the debugger, it then highlights following line within the
“Else†loop…
lngSupport_Group = Me![Support_Group_Name]
Does anyone know what I may be doing wrong?
Any assistance would be much appreciated…
a combo-box within Access.
I have a form named “Applications†that has (among other objects) a
combo-box named “Support_Goup_Name†that links to a field called
“Support_Goup_Name†within table called “Support_Groupsâ€. I also have a
separate form named “Support_Groups†that displays a combo-box named
“Support_Goup_Nameâ€.
The Applications form is used to add applications and support groups to a
given system, and I need to be able to choose either from an existing support
group (this works now), or add a new support group on demand (does not yet
work).
I am trying to make use of the “DblClick†and “DoCmd.OpenForm†functions to
allow a user to double-click on the “Support_Goup_Name†combo-box to
dynamically create a new record as required. After searching for code
examples, I found a code snippet on the Microsoft site. I then altered the
snippet with what I thought might be the appropriate modifications as follows…
Private Sub Support_Group_Name_DblClick(Cancel As Integer)
Dim lngSupport_Group As Long
If IsNull(Me![Support_Group_Name]) Then
Me![Support_Group_Name].Text = ""
Else
lngSupport_Group = Me![Support_Group_Name]
Me![Support_Group_Name] = Null
End If
DoCmd.OpenForm "Support_Groups", , , , , acDialog, "GotoNew"
Me![Support_Group_Name].Requery
If lngSupport_Group <> 0 Then Me![Support_Group_Name] = lngSupport_Group
End Sub
When I double-click on the combo-box after entering this snippet, the system
displays the following error dialogue box…
Run-time error '13':
Type mismatch
When I launch the debugger, it then highlights following line within the
“Else†loop…
lngSupport_Group = Me![Support_Group_Name]
Does anyone know what I may be doing wrong?
Any assistance would be much appreciated…