I'm not sure why you removed the quotes from around the first and second arguments of the Dlookup(). Also, why are you using "fscSchStartTime" and "[forms]![f_8TeamSeasonSchedule]![hlpGame1Time]" twice? Is there supposed to be something else in the criteria?
You might want to try:
IIf DCount("*","t_FacilitySchedule", "fscFacID=" & _
[forms]![f_8TeamSeasonSchedule]![cboLocDay1] & _
" AND fscSchDate =#" & _
[forms]![f_8TeamSeasonSchedule]![hlpDay1Date]&"# " & _
" AND fscSchStartTime = #" & _
[forms]![f_8TeamSeasonSchedule]![hlpGame1Time] & "#)" > 0 Then
Duane Hookom
MS Access MVP
--- In MS_Access_Professionals@yahoogroups.com, Bill.Singer@... wrote:
>
> John,
> Yes, each of the 3 work and provide the correct answer. Thank you. I wish I could find a place that has all of these rules written down. Each of these statements is part of a check to make sure I do not post double records. Now I have to hook all 3 of the checks together in the Criteria of the DLookup. With all of the "&# characters I cannot figure out how to have the DLookup consider all 3 of the phrases.
>
> Below is all of what I have without the characters to link the 3 statements together. I know I need a " at the begining of each line but I could not figure out where to put the other one. I left all of my failed attempts out of this to not confuse. I get a compile error at the "AND" of the second line, which is where I know I am missing "
> I really appreciate your help.
>
>
> strSQLdup = "If Not IsNull(DLookup(fscFscID,t_FacilitySchedule, fscFacID=" & [forms]![f_8TeamSeasonSchedule]![cboLocDay1] & _
> AND "fscSchDate=#" & [forms]![f_8TeamSeasonSchedule]![hlpDay1Date]&"#" & _
> AND "fscSchStartTime= #" & [forms]![f_8TeamSeasonSchedule]![hlpGame1Time] & "#" & _
> AND "fscSchStartTime= #" & [forms]![f_8TeamSeasonSchedule]![hlpGame1Time] & "#" ))" Then
> MsgBox "You have already schedule this game or another activity at this time"
>
>
>
>
> Thanks,
> Bill
>
>
>
> -----Original Message-----
> From: John Viescas [mailto:JohnV@...]
> Sent: Sunday, June 3, 2012 03:08 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: RE: [MS_AccessPros] Syntax error Mission operator
>
> Bill-
>
> Like this:
>
> ?DLookup("[fscFscID]","t_FacilitySchedule","fscSchDate= #" &
> [forms]![f_8TeamSeasonSchedule]![hlpDay1Date] & "#")
>
> ?DLookup("[fscFscID]","t_FacilitySchedule","fscStartTime= #" &
> [forms]![f_8TeamSeasonSchedule]![hlpGame1Time] & "#")
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
> -----------------
>
> From: mailto:MS_Access_Professionals%40yahoogroups.com
> [mailto:mailto:MS_Access_Professionals%40yahoogroups.com] On Behalf Of agent1of6
> Sent: Sunday, June 03, 2012 8:51 PM
> To: mailto:MS_Access_Professionals%40yahoogroups.com
> Subject: [MS_AccessPros] Syntax error Mission operator
>
>
> I am working in the Immediate Window to test my code piece by piece. It was
> working great as I am 75% of the way through and I ran into error I cannot
> solve.
>
> Why would this code work (compares location ID's)
> ? DLookup("[fscFscID]","t_FacilitySchedule","fscFacID=" &
> [forms]![f_8TeamSeasonSchedule]![cboLocDay1]
>
> ...and this code gives me a Null return, should be 2 (Compares schedule dates)
> ? DLookup("[fscFscID]","t_FacilitySchedule","fscSchDate=" &
> [forms]![f_8TeamSeasonSchedule]![hlpDay1Date])
>
> ...and this code gives me an error (compares start times)
>
> ? DLookup("[fscFscID]","t_FacilitySchedule","fscStartTime=" &
> [forms]![f_8TeamSeasonSchedule]![hlpGame1Time])
>
> I have tried to enter the ## but I must be getting it wrong and I can't find any
> good models. How do I format Dates and times to get them to compare to each
> other?
>
> Thanks for you assistance,
> Bill
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
Minggu, 03 Juni 2012
[MS_AccessPros] Re: Syntax error Mission operator
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar