Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2013
    Posts
    29

    Unanswered: WHERE procedure in VBA

    I have a variable "imie"

    I would like to do something like this

    Code:
    Forms!frmZlecenieMarzena!frmGoraZlecenia.Form!Id_Pracownika = imie
    - Where Forms!frmZlecenieMarzena!frmGoraZlecenia.Form!ID_z lecenia = Froms!frmzlecenieMarzena!Id_Zlecenia

    The question is, how to write it in vba?

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,422
    Provided Answers: 7
    The SQL does not know what a form is you have to tell it.

    Where feildname ="something" string

    Or

    Where feildname = something Number

    So

    Your where

    Sqlwhere = formnameformfeildname & "="" & formnameformfeildname & """

    The " count mite be out doing this on the iPad lol
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    sorry Im not certain what you want to do

    do you mean you want retrieve rows in a form whose 'Id_Pracownika' = imie?
    one way of doing that is to apply a filter.

    assuming that mycolumnname is a numeric value
    Code:
    me.filter = "mycolumnname = " & imie
    me.filteron.true
    if mycolumnname is text/string value then you have to delimit the string value with ' (or "
    Code:
    me.filter = "mycolumnname = '" & imie & "'"
    me.filteron.true
    replace mycolumnname with whatever the column in your table is actually called

    if mycolumnname is a date value then you have to delimit the date with #
    Code:
    me.filter = "mycolumnname = " & format(imie,"#YYYY/MM/DD#")
    me.filteron.true
    to turn the filter off
    Code:
    me.filteron=false
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2013
    Posts
    29
    fmZlecenieMarzena is a form
    frmGoraZlecenia is a subform (datasheet).

    The code should do this procedure:
    Take the value from variable "imie" and put in my subform in all records in "Id_pracownika" column, where "Id_zlecenia" field in my subform equal to "id_zlecenia" field in my form.
    the variable "imie" can look like "3" or "6"
    the filed "id_zlecenia" can look like "120/13" or "1450/13"

    myle could you write the code? Because I think it would be to complicated for me:/
    healdem I can't use me.filter option

Posting Permissions

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