Search Results

Search found 4 results on 1 pages for 'primus285'.

Page 1/1 | 1 

  • Access Database using do.cmd openform where clasue - returning all values

    - by primus285
    DoCmd.OpenForm "Database Search", acFormDS, , srcLastName & "AND " & srcFirstName This is only a small sample of the where clause - there are many more terms. First, there is a set of If, Then type tings up top that set the variable srcLastName and srcFirstName to some value. These are not the problem and work just fine. The trouble is getting them to return all values (for instance if you only want to search by one, on neither(return full database list)) Thus far I have settled for (in the if then section): srcLastName = "[Lastname] =" & Chr(34) & cboLastName & Chr(34) - to search for something and srcLastName = "[Lastname] <" & Chr(34) & "Nuthin" & Chr(34) - to return everything (not equal to an absurd and mispelled database term.) The trouble is that data that is null is also not returned. If I have a null firstname, it will not show up in any search period. is there a term I can set [lastname] and [firstname] equal to that will return EVERYTHING (null, open, data, numbers, wierd stuff and otherwise) in a search an SQL form of "give me everything shes got scotty" if you will. the real issue here comes from the data entry - if I could just know that the people would enter everything 100% of the time, this code would work. but forget to enter the persons age or whatever, and it wont return that entry. So far, the only other solution I have come up with is to put a counter in each if then statement. The count will go up by one for each thing that is being searched by. Then if the count is = 1, then I can search by something like just DoCmd.OpenForm "Database Search", acFormDS, , srcLastName or DoCmd.OpenForm "Database Search", acFormDS, , srcFirstName then revert back to the DoCmd.OpenForm "Database Search", acFormDS, , srcLastName & "AND " & srcFirstName when the count is 2 or more truoble here is that it only works for one (unless I so wanted to create a custon list of 2 combined, 3 combined, 4 combined, but that is not happening)

    Read the article

  • Row Source - combo box, filtering what pops up in a combo box by date

    - by primus285
    so I have a combo box that I want to pop up when somebody wants to search by year. It will allow them to see in that combo box only results that happened in a certain year. so far I have something like SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE (((Database_New.Date) >= DateValue('01/01/2001') AND (((Database_New.Date) <= DateValue('12/031/2001'))); or SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE (((Database_New.Date) >= BETWEEN DateValue('01/01/2001') AND DateValue('12/31/2001’))); as you can see, the kicker is that I am already sorting the thing with SELECT DISTINCT under the ASEC field. But I want to filter it one more by year so a whole bunch of ASEC values that didnt happen in that year (and there are quite a few that happen rarely, or would onyl be associeted with one year) do not pop up as avalible. so far I get an error like "Syntax error in query expression '(((Database_New.Date) = DateValue('01/01/2001') AND (((Database_New.Date) <= DateValue('12/031/2001')))' and I am a VBA person, not quite as good at debuggin SQL. Is it something easy? or will it simply not work the way I have it set up.

    Read the article

  • MS Acess SQL - where clause to get year from date based on the year - data located in MS access form

    - by primus285
    OK, back again. I have a problem getting a drop down list to populate based on information in two fields. I have got the SQL correct as to Select just one year if I put DateValue('01/01/2001') in both places, but I am trying now to get it to grab the year data from the MS access form - another drop down named "cboYear". I'd hate to have to do something in VB, unless necessary. so far I have gotten this to pull up something (its always incorrect) SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE Database_New.Date>=DateValue('01/01/' & [cboYear]) And Database_New.Date<=DateValue('12/31/' & [cboYear]); and SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE Database_New.Date>=DateValue('01/01/' + [cboYear]) And Database_New.Date<=DateValue('12/31/' + [cboYear]); SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE Database_New.Date>=DateValue('01/01/' AND [cboYear]) And Database_New.Date<=DateValue('12/31/' AND [cboYear]); both give errors saying that it is too complex to compute. Its probably something simple, but where do I go from here?

    Read the article

  • getting a combo box that has a row source equal to a query - and the query takes data from a form -

    - by primus285
    I have a combo box with a row source based on an SQL query about like SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE Database_New.Date= DateSerial([cboYear], 1, 1) And Database_New.Date<= DateSerial([cboYear], 12, 31); the trouble is that if I change the value of cboYear, the values in the drop down cboASEC do not update. I have to open the query, save it and close it to get the thing to update while I have the form open. Is there a way to get the cboASEC to update somehow? maybe a little tidbit of code in the cboYear - afterupdate?

    Read the article

1