Type Mismatch

G

Guest

The following is returning a Type mismatch. I can't see it. Can anyone please
help?

Thanks!

Private Sub City_DblClick(Cancel As Integer)
On Error GoTo Err_City_DblClick
Dim lngCity As Long

If IsNull(Me![City]) Then
Me![City].Text = ""
Else
lngCity = Me![City]
Me![City] = Null
End If
DoCmd.OpenForm "frmCities", , , , , acDialog, "GotoNew"
Me![City].Requery
If lngCity <> 0 Then Me![City] = lngCity

Exit_City_DblClick:
Exit Sub

Err_City_DblClick:
MsgBox Err.Description
Resume Exit_City_DblClick
End Sub
 
J

J_Goddard

Hi -

First thing you should do is comment out the On Error statement, then run the
code to see which line is causing the error.

What is Me![city]? A combo box? If so, is IngCity being assigned the value
from the proper column?

John
 
G

Guest

Thanks! I revised to this and it works:

Private Sub City_DblClick(Cancel As Integer)
On Error GoTo Err_City_DblClick
Dim lngCity As Double

If IsNull(Me![City]) Then
Me![City].Text = ""
Else
dblCity = Me![City]
Me![City] = Null
End If
DoCmd.OpenForm "frmCities", , , , , acDialog, "GotoNew"
Me![City].Requery
If dblCity <> 0 Then Me![City] = dblCity

Exit_City_DblClick:
Exit Sub

Err_City_DblClick:
MsgBox Err.Description
Resume Exit_City_DblClick
End Sub

--
www.Marzetti.com


J_Goddard said:
Hi -

First thing you should do is comment out the On Error statement, then run the
code to see which line is causing the error.

What is Me![city]? A combo box? If so, is IngCity being assigned the value
from the proper column?

John

The following is returning a Type mismatch. I can't see it. Can anyone please
help?

Thanks!

Private Sub City_DblClick(Cancel As Integer)
On Error GoTo Err_City_DblClick
Dim lngCity As Long

If IsNull(Me![City]) Then
Me![City].Text = ""
Else
lngCity = Me![City]
Me![City] = Null
End If
DoCmd.OpenForm "frmCities", , , , , acDialog, "GotoNew"
Me![City].Requery
If lngCity <> 0 Then Me![City] = lngCity

Exit_City_DblClick:
Exit Sub

Err_City_DblClick:
MsgBox Err.Description
Resume Exit_City_DblClick
End Sub
 

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