Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query Stopped Working
Message
 
 
À
19/07/2013 12:09:09
Information générale
Forum:
Visual Basic
Catégorie:
Access
Divers
Thread ID:
01578395
Message ID:
01578890
Vues:
42
>>>>>This query was working fine, but then all of a sudden it stopped pulling data. No errors, just empty results.
>>>>>
>>>>>
>>>>>SELECT Salutation.Salutation, Valid_Numbers.[First Name], Valid_Numbers.[Last Name], Valid_Numbers.[House Number] & " " & [Street Name] AS Address, Valid_Numbers.City, Valid_Numbers.ST, Valid_Numbers.ZIP, Valid_Numbers.[Date of Birth]
>>>>>FROM Salutation INNER JOIN Valid_Numbers ON Salutation.ID=Valid_Numbers.Salutation
>>>>>WHERE switch(Len([date of birth])=7,Left([date of birth],2)=Month(Date()),Len([date of birth])=6,left([date of birth],1)=Month(Date()));
>>>>>
>>>>
>>>>Are you using Access database? Have you tried running it in Access, not in VB? Also, have you checked if your tables still have data?
>>>>
>>>>Also, can you translate this complicated WHERE condition into English for me? What do you want to get?
>>>
>>>What is the format of the data within the [date of birth] column? Whatever guesses that I can make about the format don't seem to match the logic given in the switch() function.
>>
>>I suspect it is character, but let's wait for Jim to answer this question.
>
>Best guess I can make about the intent of the WHERE clause is to show records with people with birthdays this month.

In this case it's better to check this http://www.berezniker.com/content/pages/sql/microsoft-sql-server/birthday-query-ms-sql-server and adapt for Access.

Also, it is always a bad idea to store date as character. Someone even wrote a blog about it:

Dear ISV: You’re Keeping Me Awake Nights with Your VARCHAR() Dates
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform