Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

send Keys problem

Discussion in 'Information Technology' started by Halocarbon, Jul 28, 2006.

Tags:
  1. Halocarbon

    Halocarbon
    Expand Collapse
    Guest

    I have a database that when my users open a form a macro runs to put the
    focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    is in the box the macro uses the send keys function {down} to select the
    number in the box. When the form first opens the focus is set correctly, but
    the send keys function does not work. I can close the form and immediatly
    reopen it and the send keys function works. What is wrong and can I do this
    in another way other than the send keys function?
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News Why This Sikh Cartoonist Is Sending A Postcard To Trump Every Day Breaking News Mar 23, 2016
    UK Statue of turbaned Sikh fighter pilot unveiled in Gravesend Breaking News Nov 29, 2014
    Leisure Appropriate to send flowers to a friend's ill Mother in India? Business, Lifestyle & Leisure Jun 6, 2013
    USA Preet Bharara Sends a Message to Wall Street about Insider Trading Breaking News May 18, 2011
    USA U.S. Sends Warning to People Named in Cable Leaks Breaking News Jan 7, 2011

  3. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Instead of using SendKeys, simply assign the value to the combo

    me.combo_controlname = value


    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Halocarbon wrote:
    > I have a database that when my users open a form a macro runs to put the
    > focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    > is in the box the macro uses the send keys function {down} to select the
    > number in the box. When the form first opens the focus is set correctly, but
    > the send keys function does not work. I can close the form and immediatly
    > reopen it and the send keys function works. What is wrong and can I do this
    > in another way other than the send keys function?
     
  4. Halocarbon

    Halocarbon
    Expand Collapse
    Guest

    I can't assign a value to this text box because it changes every time the
    form opens. This is a number that increases by 1 each time.

    "strive4peace" <"strive4peace2006 at yaho" wrote:

    > Instead of using SendKeys, simply assign the value to the combo
    >
    > me.combo_controlname = value
    >
    >
    > Warm Regards,
    > Crystal
    > Microsoft Access MVP 2006
    >
    > *
    > Have an awesome day ;)
    >
    > remote programming and training
    > strive4peace2006 at yahoo.com
    >
    > *
    >
    > Halocarbon wrote:
    > > I have a database that when my users open a form a macro runs to put the
    > > focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    > > is in the box the macro uses the send keys function {down} to select the
    > > number in the box. When the form first opens the focus is set correctly, but
    > > the send keys function does not work. I can close the form and immediatly
    > > reopen it and the send keys function works. What is wrong and can I do this
    > > in another way other than the send keys function?

    >
     
  5. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Hi Halo,

    if what you want it the first item in the list

    'list has heading row
    me.controlname = [controlname].[ItemData](1)

    'list does not have heading row
    me.controlname = [controlname].[ItemData](0)

    do this on the LOAD event, not the Open event...

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Halocarbon wrote:
    > I can't assign a value to this text box because it changes every time the
    > form opens. This is a number that increases by 1 each time.
    >
    > "strive4peace" <"strive4peace2006 at yaho" wrote:
    >
    >
    >>Instead of using SendKeys, simply assign the value to the combo
    >>
    >>me.combo_controlname = value
    >>
    >>
    >>Warm Regards,
    >>Crystal
    >>Microsoft Access MVP 2006
    >>
    >> *
    >> Have an awesome day ;)
    >>
    >> remote programming and training
    >> strive4peace2006 at yahoo.com
    >>
    >> *
    >>
    >>Halocarbon wrote:
    >>
    >>>I have a database that when my users open a form a macro runs to put the
    >>>focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    >>>is in the box the macro uses the send keys function {down} to select the
    >>>number in the box. When the form first opens the focus is set correctly, but
    >>>the send keys function does not work. I can close the form and immediatly
    >>>reopen it and the send keys function works. What is wrong and can I do this
    >>>in another way other than the send keys function?

    >>
     
  6. Halocarbon

    Halocarbon
    Expand Collapse
    Guest

    I don't think that will work either. This lot number is not in a list the
    database does a calculation to generate this number. The lot number is not
    part of a list. Our lot numbers are generated through a query function:
    Max Of Sample ID: Max([Sample Registration].[Sample ID])+1

    is there code that I can put in there that will put the focus in the list
    box (called Sample ID) and simulate a mouse click in that box? You know when
    you click in a list box it turns black to show it is selected, that is what I
    need to happen automatically. I am sorry for the trouble, I am still learning
    as I go.

    "strive4peace" <"strive4peace2006 at yaho" wrote:

    > Hi Halo,
    >
    > if what you want it the first item in the list
    >
    > 'list has heading row
    > me.controlname = [controlname].[ItemData](1)
    >
    > 'list does not have heading row
    > me.controlname = [controlname].[ItemData](0)
    >
    > do this on the LOAD event, not the Open event...
    >
    > Warm Regards,
    > Crystal
    > Microsoft Access MVP 2006
    >
    > *
    > Have an awesome day ;)
    >
    > remote programming and training
    > strive4peace2006 at yahoo.com
    >
    > *
    >
    > Halocarbon wrote:
    > > I can't assign a value to this text box because it changes every time the
    > > form opens. This is a number that increases by 1 each time.
    > >
    > > "strive4peace" <"strive4peace2006 at yaho" wrote:
    > >
    > >
    > >>Instead of using SendKeys, simply assign the value to the combo
    > >>
    > >>me.combo_controlname = value
    > >>
    > >>
    > >>Warm Regards,
    > >>Crystal
    > >>Microsoft Access MVP 2006
    > >>
    > >> *
    > >> Have an awesome day ;)
    > >>
    > >> remote programming and training
    > >> strive4peace2006 at yahoo.com
    > >>
    > >> *
    > >>
    > >>Halocarbon wrote:
    > >>
    > >>>I have a database that when my users open a form a macro runs to put the
    > >>>focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    > >>>is in the box the macro uses the send keys function {down} to select the
    > >>>number in the box. When the form first opens the focus is set correctly, but
    > >>>the send keys function does not work. I can close the form and immediatly
    > >>>reopen it and the send keys function works. What is wrong and can I do this
    > >>>in another way other than the send keys function?
    > >>

    >
     
  7. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Hi Halo,

    I am a bit confused... clicking on an entry is the same as
    selecting it, which is the same as assigning the value to
    the control

    If this is a combo:
    If the lot number is not in the list, I assume you have
    LimitToList=no

    Do you have LimitToList=yes and are trying to add an item to
    the list?

    If this is a listbox... you have to pick something that is
    on the list. And if it is a listbox, it is single-select?

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Halocarbon wrote:
    > I don't think that will work either. This lot number is not in a list the
    > database does a calculation to generate this number. The lot number is not
    > part of a list. Our lot numbers are generated through a query function:
    > Max Of Sample ID: Max([Sample Registration].[Sample ID])+1
    >
    > is there code that I can put in there that will put the focus in the list
    > box (called Sample ID) and simulate a mouse click in that box? You know when
    > you click in a list box it turns black to show it is selected, that is what I
    > need to happen automatically. I am sorry for the trouble, I am still learning
    > as I go.
    >
    > "strive4peace" <"strive4peace2006 at yaho" wrote:
    >
    >
    >>Hi Halo,
    >>
    >>if what you want it the first item in the list
    >>
    >>'list has heading row
    >>me.controlname = [controlname].[ItemData](1)
    >>
    >>'list does not have heading row
    >>me.controlname = [controlname].[ItemData](0)
    >>
    >>do this on the LOAD event, not the Open event...
    >>
    >>Warm Regards,
    >>Crystal
    >>Microsoft Access MVP 2006
    >>
    >> *
    >> Have an awesome day ;)
    >>
    >> remote programming and training
    >> strive4peace2006 at yahoo.com
    >>
    >> *
    >>
    >>Halocarbon wrote:
    >>
    >>>I can't assign a value to this text box because it changes every time the
    >>>form opens. This is a number that increases by 1 each time.
    >>>
    >>>"strive4peace" <"strive4peace2006 at yaho" wrote:
    >>>
    >>>
    >>>
    >>>>Instead of using SendKeys, simply assign the value to the combo
    >>>>
    >>>>me.combo_controlname = value
    >>>>
    >>>>
    >>>>Warm Regards,
    >>>>Crystal
    >>>>Microsoft Access MVP 2006
    >>>>
    >>>> *
    >>>> Have an awesome day ;)
    >>>>
    >>>> remote programming and training
    >>>> strive4peace2006 at yahoo.com
    >>>>
    >>>> *
    >>>>
    >>>>Halocarbon wrote:
    >>>>
    >>>>
    >>>>>I have a database that when my users open a form a macro runs to put the
    >>>>>focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    >>>>>is in the box the macro uses the send keys function {down} to select the
    >>>>>number in the box. When the form first opens the focus is set correctly, but
    >>>>>the send keys function does not work. I can close the form and immediatly
    >>>>>reopen it and the send keys function works. What is wrong and can I do this
    >>>>>in another way other than the send keys function?
    >>>>
     
  8. Halocarbon

    Halocarbon
    Expand Collapse
    Guest

    ok....I am sorry for the confusion. You were correct. It is a list box, and
    it is sinfle select. The Lot number is the only item in the list box. I tried
    your
    > >>'list does not have heading row
    > >>me.controlname = [controlname].[ItemData](0)

    but i get an action failed error every time. Maybe I have entered it wrong
    here is what I have.

    Click a command button to Open the "ETFA Form" form.
    When "ETFA" Form Opens the on load property runs a macro called "ETFA.Lock
    Lot Number"
    This is the macro:GoToControl: Date
    SetValue:
    Item: [Forms]![ETFA Form]![date]
    Expression: Now()
    GoToControl: HalocarbonLotNumber
    Run Code: me.halocarbonlotnumber =
    [halocarbonlotnumber].[ItemData](0)

    Everything works except the run code line. Have I input something wrong? All
    of your ideas have been greatly appreciated and I truly thank you for taking
    the time to help me out!

    "strive4peace" <"strive4peace2006 at yaho" wrote:

    > Hi Halo,
    >
    > I am a bit confused... clicking on an entry is the same as
    > selecting it, which is the same as assigning the value to
    > the control
    >
    > If this is a combo:
    > If the lot number is not in the list, I assume you have
    > LimitToList=no
    >
    > Do you have LimitToList=yes and are trying to add an item to
    > the list?
    >
    > If this is a listbox... you have to pick something that is
    > on the list. And if it is a listbox, it is single-select?
    >
    > Warm Regards,
    > Crystal
    > Microsoft Access MVP 2006
    >
    > *
    > Have an awesome day ;)
    >
    > remote programming and training
    > strive4peace2006 at yahoo.com
    >
    > *
    >
    > Halocarbon wrote:
    > > I don't think that will work either. This lot number is not in a list the
    > > database does a calculation to generate this number. The lot number is not
    > > part of a list. Our lot numbers are generated through a query function:
    > > Max Of Sample ID: Max([Sample Registration].[Sample ID])+1
    > >
    > > is there code that I can put in there that will put the focus in the list
    > > box (called Sample ID) and simulate a mouse click in that box? You know when
    > > you click in a list box it turns black to show it is selected, that is what I
    > > need to happen automatically. I am sorry for the trouble, I am still learning
    > > as I go.
    > >
    > > "strive4peace" <"strive4peace2006 at yaho" wrote:
    > >
    > >
    > >>Hi Halo,
    > >>
    > >>if what you want it the first item in the list
    > >>
    > >>'list has heading row
    > >>me.controlname = [controlname].[ItemData](1)
    > >>
    > >>'list does not have heading row
    > >>me.controlname = [controlname].[ItemData](0)
    > >>
    > >>do this on the LOAD event, not the Open event...
    > >>
    > >>Warm Regards,
    > >>Crystal
    > >>Microsoft Access MVP 2006
    > >>
    > >> *
    > >> Have an awesome day ;)
    > >>
    > >> remote programming and training
    > >> strive4peace2006 at yahoo.com
    > >>
    > >> *
    > >>
    > >>Halocarbon wrote:
    > >>
    > >>>I can't assign a value to this text box because it changes every time the
    > >>>form opens. This is a number that increases by 1 each time.
    > >>>
    > >>>"strive4peace" <"strive4peace2006 at yaho" wrote:
    > >>>
    > >>>
    > >>>
    > >>>>Instead of using SendKeys, simply assign the value to the combo
    > >>>>
    > >>>>me.combo_controlname = value
    > >>>>
    > >>>>
    > >>>>Warm Regards,
    > >>>>Crystal
    > >>>>Microsoft Access MVP 2006
    > >>>>
    > >>>> *
    > >>>> Have an awesome day ;)
    > >>>>
    > >>>> remote programming and training
    > >>>> strive4peace2006 at yahoo.com
    > >>>>
    > >>>> *
    > >>>>
    > >>>>Halocarbon wrote:
    > >>>>
    > >>>>
    > >>>>>I have a database that when my users open a form a macro runs to put the
    > >>>>>focus in a box called "Lot Number". The form is named "ETFA". Once the focus
    > >>>>>is in the box the macro uses the send keys function {down} to select the
    > >>>>>number in the box. When the form first opens the focus is set correctly, but
    > >>>>>the send keys function does not work. I can close the form and immediatly
    > >>>>>reopen it and the send keys function works. What is wrong and can I do this
    > >>>>>in another way other than the send keys function?
    > >>>>

    >
     

Share This Page