calebm12
Jul 13 2006, 12:14 PM
I am getting rejected with this command
If Not IsNull( _
DLookup("ItemID", "tblAward", _
"ItemID = " & Chr(34) & Me.ItemID & Chr(34) & _
" And PlacingID = " & Chr(34) & Me.PlacingID & Chr(34)) _
could someone explain to me the parts of the statement. I admit taking it from another datbase and trying to convert it.

I have tblaward
awarditemID (pk)
itemid(fk)
placingid(fk)
i dont see why it wouldnt be working
adamsherring
Jul 13 2006, 12:31 PM
Hello there.
I see why its not working. I'm assuming it's giving you the error of "wrong number of arguments" or some such garbage.
Unless you've been using characters as primary & forien keys, that dlookup won't work.
Change :
If Not IsNull( _
DLookup("ItemID", "tblAward", _
"ItemID = " & Chr(34) & Me.ItemID & Chr(34) & _
" And PlacingID = " & Chr(34) & Me.PlacingID & Chr(34)) _
to :
If Not IsNull( _
DLookup("ItemID", "tblAward", _
"ItemID = " & Me.ItemID & " And PlacingID = " Me.PlacingID )
That should do the trick. With the first statement, you're telling access that the field is a text data type, and when it goes in, the field is numeric, so it blows up at you.
Adam
calebm12
Jul 13 2006, 12:33 PM
I see. It was a text field in the old database. I suppose the Chr(34) is what tell access it is a text field. i ran a search on chr(34) and really could find much on it. I will give you suggestions a shot. thanks for your help
calebm12
Jul 13 2006, 12:41 PM
Its not liking it at all
If Not IsNull( _
DLookup("ItemID", "tblAward", _
"ItemID = " & Me.ItemID & " And PlacingID = " Me.PlacingID )
Keeps highlighting me.placingid and asking for a list seperator?
adamsherring
Jul 13 2006, 12:43 PM
Hi,
chr() is a command that will take an integer (0 - 255) and turn it into an ASCII character. If you go to asciitable.net or some other place that tells you what the ascii codes are, you'll see that decimal 34 is equal to double quotes. Surrounding something in double quotes (or single quotes) will tell access that its a text field, the same way putting #'s on either end tells access that is a date field.
If you dont place anything around it, access assumes its numeric.
Hope that helps,
Adam
calebm12
Jul 13 2006, 12:45 PM
GOT IT
Figured it out. Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.