Re: Type Mismatch help for beginning programmer
- From: Ken Cobler <KenCobler@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Jul 2006 13:35:02 -0700
Hey, what do you know, it works great now. Thank you very much.
Your suspicions were correct, and it was the problem with the Null value.
Thank you for suggesting it.
I will watch out for both the Null and the DAO/ADO issues in the future.
Cheers.
"Allen Browne" wrote:
Ambiguous References can give this error, so you might want to open a code.
window, choose References from the Tools menu, and uncheck the OLE
Automation ans MS ActiveX ones. For more info, see:
Solving Problems with Library References
at:
http://allenbrowne.com/ser-38.html
For the case you describe, though, I think it might be something else. The
Enabed property is a boolean type (either Yes or No.) The value of a check
box is normally yes or no, but there are cases where it could be Null (e.g.
new record with no Default Value, or if the query is based on an outer-join
query.) If this is the problem, you could solve it by using Nz() to specify
the value when the check box is null.
For example, replace:
Me.[Text0].Enabled = Me.[MyYesNo]
with:
Me.[Text0].Enabled = Nz(Me.[MyYesNo].Value, False)
At the end of your post, you cay the "Add new record" triggers the problem,
so I'm guessing that's the approach you need.
In general, you do need to constantly be aware of the Null value. See:
Common Errors with Null
at:
http://allenbrowne.com/casu-12.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Ken Cobler" <KenCobler@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F20F9675-E3D5-4B2F-822F-5ED0E2CF8342@xxxxxxxxxxxxxxxx
I am new to Access programming. Working with Access 2002.
I created a database with some simple forms. Everything worked fine.
I then added some bells and whistles: Depending on whether a yes/no form
object is checked, a few other form objects are either Enabled or Not
Enabled. This part of the form works fine, however, now I receive an
annoying "Type Mismatch" if I scroll through all my records and reach the
end
of the records and arrive at a blank one. I also get this error if I hit
the
"Add a new record" button.
I understand that the likely problem is using DAO vs. ADO. I have a rough
grasp of the idea that my programming is causing ambiguity between two
languages(?).
I have read many of the other posts on this subject but I am still lost in
the specifics. I have made sure that my Visual Basics Tools References
shows
five different checkmarks, (VBA, Access 10.0 Object Library, OLE
Automation,
MS ActiveX Data Objects 2.5 Library, and MS DAO 3.6 Object Library), in
that
order.
Reading the other posts I see that I should set some parameters to "DAO".
I
am not sure how to do this or where. Do I put it in my form's general
declarations, or in a new Module at the database level? I've done a few
experiments but I still receive the same problem which tells me I am not
doing it right. What would be the syntax?
I would appreciate any specific directions you could give me. Thank you.
- Prev by Date: Re: Selecting multiple options/Or collapsable recordsets
- Next by Date: How to refer to the label of a subform control
- Previous by thread: Using Dlookup and Dmax with dates
- Next by thread: How to refer to the label of a subform control
- Index(es):