help! dlookup

1jet

Registered User.
Local time
Today, 22:57
Joined
Sep 15, 2008
Messages
117
Code:
Dim project1 As Control
Dim friday As Control

Set friday = Forms("frmTimesheetManager").Controls("txtDay6")
project1.Value = DLookup("[Project ID]", "tmptblHours", "[TS_Date] = "[COLOR=Red] & friday.Value[/COLOR])
HELP! This dlookup thinks my TS_Date criteria is a Null.
Anyway around this?

Cheers

EDITED = By the way I should let you know before I declared the above controls, there's a make table query. Hence table name is tmptblHours.
Also, I've already tried project1.Value = DLookup("[Project ID]", "tmptblHours", "[TS_Date] =" & Forms!frmTimesheetManager!txtDay6)

It fails with the same message saying Invalid use of null?
 
Last edited:
Is frmTimesheetManager open with the field populated when you run this. Is everything spelt correctly. Have you tried stepping through your code line by line to see what friday is being set to.
 
once again u master the art of adding pointless procedures in your coding that keeps amazing me as u go further in your project, if this code is to be wrote it'd look like this:

Code:
Dim dtfriday AS Date
 
dtfriday = Forms![frmTimesheetManager]![txtDay6]
me.project1 = DLookup("[Project ID]", "tmptblHours", "[TS_Date] = [COLOR=red]#" &[/COLOR][COLOR=red] dtfriday & "#"[/COLOR])

judging that you store days in calander type table.
 
Last edited:
what are you some sort of bully?

your ## are the only things that helped me out
your other changes were.....once again pretty useless
:)
 
5 / 5 of ur previous posts it was me who helped you out. and please oh please try to take in the idea of minimizing/optimizing your code.
 
But it helped, right? We all have to remember that not everybody here speaks English as a first language and that things written don't necessarily mean what we think they mean.

Seems like everybody's been trying to help out, and indeed, looks like they suceeded in solving your issue, which is what you wanted, right?

It was brave of nIGHT mAYOR to try to resolve your issue. The ## is the first thing I thought of when I saw your post but I decided it couldn't possibly be that with the clues you gave. That's not a slap at you or at him, it is just a testament to how incredibly difficult it is to communicate, especially over a forum with people thousands of miles away who speak a different language and have a different culture and customs. And remember, we're all volunteers here. You get what you get.

Let's give everybody the benefit of the doubt and try to help each other out.
 
5 / 5 of ur previous posts it was me who helped you out. and please oh please try to take in the idea of minimizing/optimizing your code.
Nightmayor, I wouldn't bother helping 1jet in future since he doesn't seem to want your help.
 
once again u master the art of adding pointless procedures in your coding that keeps amazing me as u go further in your project, if this code is to be wrote it'd look like this:
I think that's a bit harsh and doesn't help people who may be starting out (and even if it may be true, hurling insults is counter productive). Yes, there are things that can be improved upon. But we all started somewhere and not everyone is comfortable yet with writing compact, fully-correct code. It takes time.
 

Users who are viewing this thread

Back
Top Bottom