PaultheITGuy
Technical User
Hi,
I'm working on a database to keep a track of songs used at events, for copyright purposes.
On the main entry page I have a subform (AuthorSub) which records the writer of the song. If the author is not in the drop down list, it lets you double click on the record (Author) to open a new form (also called Author), where the name of the author can be entered. When you exit the form it requeries the subform and the drop down then includes the new writer's name.
However, I noticed today this only works if you double click an empty record. If you double click a populated record then you get the error 'Type Mismatch'
Can anyone explain why this is, and maybe help me fix it?
Many thanks in advance.
Here is the VBA for the On Dbl Click Event:
Private Sub Author_DblClick(Cancel As Integer)
On Error GoTo Err_Author_DblClick
Dim lngAuthor As Long
If IsNull(Me![Author]) Then
Me![Author].Text = ""
Else
lngAuthor = Me![Author]
Me![Author] = Null
End If
DoCmd.OpenForm "Author", , , , , acDialog, "GotoNew"
Me![Author].Requery
If lngAuthor <> 0 Then Me![Author] = lngAuthor
Exit_Author_DblClick:
Exit Sub
Err_Author_DblClick:
MsgBox Err.Description
Resume Exit_Author_DblClick
End Sub
I'm working on a database to keep a track of songs used at events, for copyright purposes.
On the main entry page I have a subform (AuthorSub) which records the writer of the song. If the author is not in the drop down list, it lets you double click on the record (Author) to open a new form (also called Author), where the name of the author can be entered. When you exit the form it requeries the subform and the drop down then includes the new writer's name.
However, I noticed today this only works if you double click an empty record. If you double click a populated record then you get the error 'Type Mismatch'
Can anyone explain why this is, and maybe help me fix it?
Many thanks in advance.
Here is the VBA for the On Dbl Click Event:
Private Sub Author_DblClick(Cancel As Integer)
On Error GoTo Err_Author_DblClick
Dim lngAuthor As Long
If IsNull(Me![Author]) Then
Me![Author].Text = ""
Else
lngAuthor = Me![Author]
Me![Author] = Null
End If
DoCmd.OpenForm "Author", , , , , acDialog, "GotoNew"
Me![Author].Requery
If lngAuthor <> 0 Then Me![Author] = lngAuthor
Exit_Author_DblClick:
Exit Sub
Err_Author_DblClick:
MsgBox Err.Description
Resume Exit_Author_DblClick
End Sub