LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Code to Update a Record

I use the following code to search for a value in a
column and then display the field values in text boxes on
the form. I need a command to save the changes made to
the field values in the text boxes back to those specific
fields. Please help!

Private Sub cmdSearch_Click()
Dim rng As Range
With Worksheets("Sheet1").Columns(1)
Set rng = .Find(what:=frmSearch.TextBox1.Text, _
After:=Range("A65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With
If Not rng Is Nothing Then
With frmSearch
.TextBox2.Text = rng.Offset(0, 1).Value
.TextBox3.Text = rng.Offset(0, 2).Value
' and so forth
End With
Else
MsgBox frmSearch.TextBox1.Text & _
" was not found"
End If
End Sub

 
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
record update VBA form Roy Gudgeon[_2_] Excel Discussion (Misc queries) 0 March 15th 10 04:27 PM
want to record date for each time I update a file PattyR Excel Discussion (Misc queries) 2 May 27th 09 05:40 AM
On Duplicate, update record MikeD1224 Excel Discussion (Misc queries) 1 April 2nd 09 10:19 PM
record a macro to update pivot table louiscourtney Excel Discussion (Misc queries) 1 July 21st 07 04:50 AM
Master List Losing Record Due to Update from Links Kenneth CN New Users to Excel 2 December 7th 04 04:11 PM


All times are GMT +1. The time now is 06:48 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"