Type Mismatch Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a series of three cascading combo boxes that have been working as
desired for months. All of a sudden, there is one set of choices in the third
combo box (cboDescription) that is triggering a "Run time error 13 -- Type
mismatch" error. All other choices work fine. When I click Debug, it
highlights the first line of the following code, which fills in a control
(Identifier) once a selection is made in cboDescription. (I have added a
requery of Identifier after this code, because at times the Identifier
control does not change if I make different selections in the combo box
series.

cboDescription After Update Event
If Not IsNull(Me(DescriptionID)) Then
Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [DescriptionText]
End If

Me![Identifier].Requery

I have decompiled, compacted, and recompiled this database several times.
Does anyone have any thoughts on this problelm?
 
Susan L said:
I have a series of three cascading combo boxes that have been working
as desired for months. All of a sudden, there is one set of choices
in the third combo box (cboDescription) that is triggering a "Run
time error 13 -- Type mismatch" error. All other choices work fine.
When I click Debug, it highlights the first line of the following
code, which fills in a control (Identifier) once a selection is made
in cboDescription. (I have added a requery of Identifier after this
code, because at times the Identifier control does not change if I
make different selections in the combo box series.

cboDescription After Update Event
If Not IsNull(Me(DescriptionID)) Then
Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [DescriptionText]
End If

Me![Identifier].Requery

I have decompiled, compacted, and recompiled this database several
times. Does anyone have any thoughts on this problelm?

I'm puzzled. The expression

Me(DescriptionID)

would only make sense if the field or control named "DescriptionID"
contained the name of another control or field on the form. That
*might* be the way you have this set up, but it seems much more likely
that you should have written

If Not IsNull(Me("DescriptionID")) Then

or


If Not IsNull(Me!DescriptionID) Then

instead. That's assuming that DescriptionID is the field to which
cboDescription is bound.
 
Dirk: I appreciate your response. When I change the code to the syntax you
describe, for some reason I am no longer able to make a selection in the cbo
Description combo box. I don't remember where I found that syntax (I'm
definitely a newbie), but I have an earlier copy of this database where it
works perfectly. what is working is: If Not IsNull(Me(cboDescription))
Then
Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [DescriptionText]
End If
There are 68 choices available for the cbo Description, and every one works
except for the three related to one category (selected in the 2nd cbo).

I tried removing the code completely, and still am not able make a selection
in the combo. Furthermore, I cannot compile the code; the command is not
available.
I think there is something wrong with database. For example, another problem
I'm having -- I have installed Allen Browne's Audit Trail module and code
behind the form, and only half is working: Delete and Edit From entries show
up in the audit table but not Insert and Edit To.

I don't know whether you have other thoughts on these issues. I'm going to
be on vacation next week, but will check the postings. When I return from
vacation, I think I'll create a fresh blank database and pull everything
over. Or try out any other suggestions you may have. Thanks.
 
Susan L said:
Dirk: I appreciate your response. When I change the code to the
syntax you describe, for some reason I am no longer able to make a
selection in the cbo Description combo box. I don't remember where I
found that syntax (I'm definitely a newbie), but I have an earlier
copy of this database where it works perfectly. what is working is:
If Not IsNull(Me(cboDescription)) Then
Me![Identifier] = [TicketNum] & " - " & [State] _
& " - " & [ReceivedDate] & " - " & [DescriptionText]
End If
There are 68 choices available for the cbo Description, and every one
works except for the three related to one category (selected in the
2nd cbo).

I tried removing the code completely, and still am not able make a
selection in the combo. Furthermore, I cannot compile the code; the
command is not available.
I think there is something wrong with database. For example, another
problem I'm having -- I have installed Allen Browne's Audit Trail
module and code behind the form, and only half is working: Delete and
Edit From entries show up in the audit table but not Insert and Edit
To.

I don't know whether you have other thoughts on these issues. I'm
going to be on vacation next week, but will check the postings. When
I return from vacation, I think I'll create a fresh blank database
and pull everything over. Or try out any other suggestions you may
have. Thanks.

I think you'd better give a more complete description of the form, its
recordsource, the relevant controls on the form, their controlsources,
and the rowsources of the combo boxes. Please include the relevant
tables and their relationships, and the code behind the combo boxes. It
could be that there's some code corruption here, but it seems to me that
if this code used to work -- or "mostly works" now -- you must have an
unusual setup. I need to understand that setup before I can give good
advice.

In the mean time, I can only suggest that you look into two things.
First, if you are running Access 2000 or later and have the Name
AutoCorrect switched on (Tools -> Options..., General), turn it off.
Second, the code that you say used to work says
If Not IsNull(Me(cboDescription)) Then

while the code you say isn't working says
If Not IsNull(Me(DescriptionID)) Then

Is there significance to the change in the name of the control or field?
I can't say, because I don't really understand the setup, and this seems
like unusual code anyway, as I explained in my earlier post.
 
Back
Top