#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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 ...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default 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" wrote in message
...
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 ...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Edit Forms

Tom

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

Correct?

Steve

"Steve" <No Spam wrote in message ...
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" wrote in message
...
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 ...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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 ...
Tom

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

Correct?

Steve

"Steve" <No Spam wrote in message ...
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" wrote in message
...
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 ...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Edit Forms

Tom

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

--
Steve


"Tom Ogilvy" wrote in message
...
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 ...
Tom

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

Correct?

Steve

"Steve" <No Spam wrote in message ...
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" wrote in message
...
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 ...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel forms - authorise / deny forms Ian Manning Excel Programming 1 May 8th 06 05:03 PM
Why can't I edit my excel document? Edit buttons shaded. Arl @ CBC New Users to Excel 3 September 7th 05 01:18 AM
RefEdits and normal forms / forms in a DLL David Welch Excel Programming 0 December 1st 04 03:49 PM
Forms that open from forms Azza Excel Programming 1 October 12th 04 10:54 PM
Calling Forms from Forms - Exit problems Stuart[_5_] Excel Programming 3 May 25th 04 06:50 AM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"