Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    4

    Smile Unanswered: requery info on form

    I hope someone can help

    i am running a query
    SELECT Avg(WTFT)
    FROM Truplast
    WHERE PRODUCTCODE Like [FORMS]![truplast]![productcode] AND DATE >=[forms]![truplast]![date] AND DATE2 <=[forms]![truplast]![date2];

    on the form im using if i enter all three variables and use a button to requery it doesnt requery the info, but if i delete DATE2 <=[forms]![truplast]![date2]; from the query and only use the 2 variable the query works what am i doing wrong ive done this same thing to open reports and it works great.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    dunno why its not working......
    theres a couple of things that could cause minor problems
    first off you are using the reserved word DATE
    id be tempted to coerce the form variables into a date variable using the CDATE function
    you are using the LIKE clause with out a matching wild card
    you are not qualifying/encapsulating/terminating your string values (assuming that productcode is a string, rather than a number, if it is numeric then in my books its wrongly named.. )

    you could use the between clause
    Code:
    WHERE PRODUCTCODE = [FORMS]![truplast]![productcode] AND DATE BETWEEN cdate([forms]![truplast]![date]) AND cdate([forms]![truplast]![date2]);
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2010
    Posts
    4

    reply

    I really appriciate your help, I havent done alot with access, i figured out that my text boxes were labeled textbox and not as the Date and Date2


    thanks for your help,

    by the way is there a way to have put info into 2 columns with just one text box

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by kaysersoze View Post
    by the way is there a way to have put info into 2 columns with just one text box
    theres always a way
    providing you can easily define where the breakpoint is that is.
    place some code behind the forms beforeupdate event

    'first off find where the value should be broken
    'split the value into its two constiuent parts
    'do any validation

    so lets say you decide the use the / symbol as a separator
    you coudl search for that symbol using instr but a better solution will almost certainly be the split function
    dim strValues as string()
    strvalues=split(mycontrol,"/")
    'so you now have a zero based array of words
    value1=strValues(0)
    value2=strValues(1)
    ..and so on.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •