If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Please help with Type Mismatch Error
I am using a split database
I have the following lookup statement DLookup("CraftAH", "HoursTracking", "MonthID = " & Me.ID And "CompanyID = 'SLM'") The statement hangs up on "MonthID = " & Me.ID The properties of MonthID (in Table HoursTracking) and ID (in another Table) are both long integer. ID in the other table is however an autonumber field. Am I missing something here??? If anybody could suggest something it would be much appreciated. |
#2
|
|||
|
|||
Please help with Type Mismatch Error
looks like the problem is a misplaced double quote and a missing ampersand.
try DLookup("CraftAH", "HoursTracking", "MonthID = " & Me.ID _ & "And CompanyID = 'SLM'") hth wrote in message ups.com... I am using a split database I have the following lookup statement DLookup("CraftAH", "HoursTracking", "MonthID = " & Me.ID And "CompanyID = 'SLM'") The statement hangs up on "MonthID = " & Me.ID The properties of MonthID (in Table HoursTracking) and ID (in another Table) are both long integer. ID in the other table is however an autonumber field. Am I missing something here??? If anybody could suggest something it would be much appreciated. |
#3
|
|||
|
|||
Please help with Type Mismatch Error
Thanks hth,
I tried that and I got syntax error. With number fields isn't the correct reference "MonthID = "& Me.ID Whereas if both were Text fields it would be "MonthID = '"&Me.ID&"'". Any other suggestions?? |
#4
|
|||
|
|||
Please help with Type Mismatch Error
|
#5
|
|||
|
|||
Please help with Type Mismatch Error
Thanks Fred.
I am sorry about not posting my original message but I was under the impression that if you clicked on the topic you could read back and review all of the messages relating to that particular topic as I am fairly new to this whole thing. Let me clarify about my original post which is as follows: I am using a split database I have the following lookup statement DLookup("CraftAH", "HoursTracking", "MonthID = " & Me.ID And "CompanyID = 'SLM'") The statement hangs up on "MonthID = " & Me.ID The properties of MonthID (in Table HoursTracking) and ID (in another Table) are both long integer. ID in the other table is however an autonumber field. Am I missing something here??? If anybody could suggest something it would be much appreciated. MonthID and CompanyID are both in the "HoursTracking" Table. ID is a field in a parent form which is linked to the child form via MonthID. ID is a field in another table called "HoursMonthly". ID is an autonumber long integer. The Dlookup gives me a Type Mismatch on comparing MonthID and ID if I use "MonthID = " & Me.ID and it gives me a Syntax error if I use "MonthID = " & Me.ID & ". The function evaluates Me.ID correctly (VBA assigns the correct value) but fails to use it as a condition in the Dlookup statement (ie it gives me the Type Mismatch error when comparing it back to MonthID). I hope this is clear and any help would be appreciated. Thanks |
#6
|
|||
|
|||
Please help with Type Mismatch Error
sigh yes, the correct syntax for a number data type is
"MonthID = "& Me.ID but as i said before, the problem appears to be "a misplaced double quote and a missing ampersand." if you'll look carefully at the expression i posted, you'll see that i did not change the syntax for the MonthID. rather, i added an ampersand (&) and moved a double quote. compare my posted expression and your original posted expression and i'm sure you'll see the differences. as far as the "syntax error" goes, i made the assumption that you're using this expression in a VBA procedure. if instead you're using it directly in a form, report, or query, then the line-break character ( _ ) is not recognized. remove it, and put the entire expression all on one line. hth (and btw, "hth" stands for "hope this helps") wrote in message oups.com... Thanks hth, I tried that and I got syntax error. With number fields isn't the correct reference "MonthID = "& Me.ID Whereas if both were Text fields it would be "MonthID = '"&Me.ID&"'". Any other suggestions?? |
#8
|
|||
|
|||
Please help with Type Mismatch Error
"TC" wrote in message
oups.com... wrote: Thanks Fred. I am sorry about not posting my original message but I was under the impression that if you clicked on the topic you could read back and review all of the messages relating to that particular topic It's called a "thread". All of the messages that are posted in reply to a new topic, or posted in reply to those replies, are collectively called a thread. Whenever someone posts a reply to a thread, the post (reply) is transmitted around the world, between so-called "news servers". The problem is, that all replies do not get copied to all news servers! And even when they do, they do not necessarily get copied in the same order they were sent. So it's not unusual to see some replies, but not be able to see the original question! Or to see a reply come first, then the question come later (though that is unusual). Hence the fun of trying to communicate effectively through "usenet" - the name of this medium. Another point is that not all newsreaders work the same way. Some let you retrieve the entire thread that the current article is part of, some don't. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) |
#9
|
|||
|
|||
Please help with Type Mismatch Error
OT, but, I'm struggling to find a good newsreader. I like the way that
google groups works, but they impose a posting limit, & they won't increase it for anyone. (I know; I've asked them; they've told me!) When I *eventually* (gasp) introduce myself on the mvp newsgroup, I'll be asking everyone else what they use. Cheers, TC (MVP Access) http://tc2.atspace.com |
#10
|
|||
|
|||
[OT] Please help with Type Mismatch Error
"TC" wrote in message
ups.com When I *eventually* (gasp) introduce myself on the mvp newsgroup, I'll be asking everyone else what they use. Come on in, the water's fine! Most of us don't bite. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Runtime Error 13 - type mismatch | hindlehey | General Discussion | 1 | November 7th, 2005 02:51 PM |
Add New Field to DB | Karen | Database Design | 7 | October 19th, 2005 08:03 PM |
Access 2003 Table sort type mismatch error | Gregory Winters | General Discussion | 3 | August 19th, 2005 08:11 PM |
Data type mismatch in criteria expression error returned... | Rashar Sharro via AccessMonster.com | Running & Setting Up Queries | 3 | April 28th, 2005 08:49 PM |
data type mismatch error 3464 | dhawkins | Running & Setting Up Queries | 1 | April 20th, 2005 11:13 PM |