+ Reply to Thread
Results 1 to 6 of 6

Edit Forms

  1. #1
    Steve
    Guest

    Edit Forms

    I know how to create a form to add records in Excel. My need is to create a
    form that allows a user to edit an existing record, without allowing the
    user to delete a record. Can someone point me in a helpful direction?

    --
    Steve



  2. #2
    Tom Ogilvy
    Guest

    Re: Edit Forms

    in you code to load the record, you would just use code like

    Textbox1.Text = Cells(i,1)
    TextBox2.Text = Cells(i,2)

    then to write it back, you similar code to that which you say you know.

    Cells(i,1) = Textbox1.Text
    Cells(i,2) = Textbox2.Text

    --
    Regards,
    Tom Ogilvy


    "Steve" <No Spam> wrote in message news:[email protected]...
    > I know how to create a form to add records in Excel. My need is to create

    a
    > form that allows a user to edit an existing record, without allowing the
    > user to delete a record. Can someone point me in a helpful direction?
    >
    > --
    > Steve
    >
    >




  3. #3
    Steve
    Guest

    Re: Edit Forms

    Tom
    I get the general idea but, there may be a thousand or so records. Would
    there be a way to load the data and filter it down (example by date or user
    loginID)?

    --
    Steve

    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > in you code to load the record, you would just use code like
    >
    > Textbox1.Text = Cells(i,1)
    > TextBox2.Text = Cells(i,2)
    >
    > then to write it back, you similar code to that which you say you know.
    >
    > Cells(i,1) = Textbox1.Text
    > Cells(i,2) = Textbox2.Text
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Steve" <No Spam> wrote in message news:[email protected]...
    >> I know how to create a form to add records in Excel. My need is to create

    > a
    >> form that allows a user to edit an existing record, without allowing the
    >> user to delete a record. Can someone point me in a helpful direction?
    >>
    >> --
    >> Steve
    >>
    >>

    >
    >




  4. #4
    Steve
    Guest

    Re: Edit Forms

    Tom

    I think I have it.
    If userID = "whatever" Then
    TextboxLinenumber = i
    ...
    end if

    Correct?

    Steve

    "Steve" <No Spam> wrote in message news:[email protected]...
    > Tom
    > I get the general idea but, there may be a thousand or so records. Would
    > there be a way to load the data and filter it down (example by date or
    > user loginID)?
    >
    > --
    > Steve
    >
    > "Tom Ogilvy" <[email protected]> wrote in message
    > news:[email protected]...
    >> in you code to load the record, you would just use code like
    >>
    >> Textbox1.Text = Cells(i,1)
    >> TextBox2.Text = Cells(i,2)
    >>
    >> then to write it back, you similar code to that which you say you know.
    >>
    >> Cells(i,1) = Textbox1.Text
    >> Cells(i,2) = Textbox2.Text
    >>
    >> --
    >> Regards,
    >> Tom Ogilvy
    >>
    >>
    >> "Steve" <No Spam> wrote in message news:[email protected]...
    >>> I know how to create a form to add records in Excel. My need is to
    >>> create

    >> a
    >>> form that allows a user to edit an existing record, without allowing the
    >>> user to delete a record. Can someone point me in a helpful direction?
    >>>
    >>> --
    >>> Steve
    >>>
    >>>

    >>
    >>

    >
    >




  5. #5
    Tom Ogilvy
    Guest

    Re: Edit Forms

    turn on the macro recorder, then do
    Edit=>Find
    and use Whatever as the search term

    then change the recorded code from

    Selection.Find(what:="Whatever", . . .).Activate

    to
    set rng = Columns(1).find(What:="Whatever", . . .)
    if not rng is nothing then
    ' cell was found
    with userform1
    .textbox1.Text = rng
    .textbox2.Text = rng.offset(0,1)
    End With
    else
    ' not found
    End if


    or if you want to loop through your data, you can use your approach.
    --
    Regards,
    Tom Ogilvy


    "Steve" <No Spam> wrote in message news:[email protected]...
    > Tom
    >
    > I think I have it.
    > If userID = "whatever" Then
    > TextboxLinenumber = i
    > ...
    > end if
    >
    > Correct?
    >
    > Steve
    >
    > "Steve" <No Spam> wrote in message news:[email protected]...
    > > Tom
    > > I get the general idea but, there may be a thousand or so records. Would
    > > there be a way to load the data and filter it down (example by date or
    > > user loginID)?
    > >
    > > --
    > > Steve
    > >
    > > "Tom Ogilvy" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> in you code to load the record, you would just use code like
    > >>
    > >> Textbox1.Text = Cells(i,1)
    > >> TextBox2.Text = Cells(i,2)
    > >>
    > >> then to write it back, you similar code to that which you say you know.
    > >>
    > >> Cells(i,1) = Textbox1.Text
    > >> Cells(i,2) = Textbox2.Text
    > >>
    > >> --
    > >> Regards,
    > >> Tom Ogilvy
    > >>
    > >>
    > >> "Steve" <No Spam> wrote in message news:[email protected]...
    > >>> I know how to create a form to add records in Excel. My need is to
    > >>> create
    > >> a
    > >>> form that allows a user to edit an existing record, without allowing

    the
    > >>> user to delete a record. Can someone point me in a helpful direction?
    > >>>
    > >>> --
    > >>> Steve
    > >>>
    > >>>
    > >>
    > >>

    > >
    > >

    >
    >




  6. #6
    Steve
    Guest

    Re: Edit Forms

    Tom

    Looping is slow. That's enough to work with. Thank you.

    --
    Steve


    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > turn on the macro recorder, then do
    > Edit=>Find
    > and use Whatever as the search term
    >
    > then change the recorded code from
    >
    > Selection.Find(what:="Whatever", . . .).Activate
    >
    > to
    > set rng = Columns(1).find(What:="Whatever", . . .)
    > if not rng is nothing then
    > ' cell was found
    > with userform1
    > .textbox1.Text = rng
    > .textbox2.Text = rng.offset(0,1)
    > End With
    > else
    > ' not found
    > End if
    >
    >
    > or if you want to loop through your data, you can use your approach.
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Steve" <No Spam> wrote in message news:[email protected]...
    >> Tom
    >>
    >> I think I have it.
    >> If userID = "whatever" Then
    >> TextboxLinenumber = i
    >> ...
    >> end if
    >>
    >> Correct?
    >>
    >> Steve
    >>
    >> "Steve" <No Spam> wrote in message news:[email protected]...
    >> > Tom
    >> > I get the general idea but, there may be a thousand or so records.
    >> > Would
    >> > there be a way to load the data and filter it down (example by date or
    >> > user loginID)?
    >> >
    >> > --
    >> > Steve
    >> >
    >> > "Tom Ogilvy" <[email protected]> wrote in message
    >> > news:[email protected]...
    >> >> in you code to load the record, you would just use code like
    >> >>
    >> >> Textbox1.Text = Cells(i,1)
    >> >> TextBox2.Text = Cells(i,2)
    >> >>
    >> >> then to write it back, you similar code to that which you say you
    >> >> know.
    >> >>
    >> >> Cells(i,1) = Textbox1.Text
    >> >> Cells(i,2) = Textbox2.Text
    >> >>
    >> >> --
    >> >> Regards,
    >> >> Tom Ogilvy
    >> >>
    >> >>
    >> >> "Steve" <No Spam> wrote in message news:[email protected]...
    >> >>> I know how to create a form to add records in Excel. My need is to
    >> >>> create
    >> >> a
    >> >>> form that allows a user to edit an existing record, without allowing

    > the
    >> >>> user to delete a record. Can someone point me in a helpful direction?
    >> >>>
    >> >>> --
    >> >>> Steve
    >> >>>
    >> >>>
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1