Display of Record Set

S

Syed Haider Ali

Dear Friends.

I have a table with three fields A,B,C. I need the code for if i pu
the value in textbox1 it searchs with Col A, if found then rest o
record shown in textbox2 and textbox3. And if it is a new record the
append the sheet.

What codes i am using are these.

dim ws as worksheet
dim irow as long

set ws= worksheets("Code")

irow=ws.cells(rows.count, 1).end(xlup).offset(1,0).row

ws.cells(irow, 1).value = me.textbox1.value
ws.cells(irow, 2).value = me.textbox2.value
ws.cells(irow,3).value = me.textbox3.value


Any suggestion please.

Syed Haider Al
 
T

Tom Ogilvy

dim ws as worksheet
dim irow as long
Dim rng as Range
Dim rng1 as Range
set ws= worksheets("Code")

irow=ws.cells(rows.count, 1).end(xlup).offset(1,0).row
set rng = ws.Range(ws.cells(1,1),ws.cells(1,irow - 1))
set rng1 = Application.Find(me.Textbox1.Value)
if not rng is nothing then
msgbox me.Textbox1.Value & " already exists"
Me.Textbox2.Value = rng.offset(0,1)
Me.Textbox3.Value = rng.offset(0,2)
else
ws.cells(irow, 1).value = me.textbox1.value
ws.cells(irow, 2).value = me.textbox2.value
ws.cells(irow,3).value = me.textbox3.value
End if

--
Regards,
Tom Ogilvy



"Syed Haider Ali"
 
S

Syed Haider Ali

Dear Tom Ogilvy,

An error "Run time error 1004" is appearing at

"set rng1=application.find(me.textbox1.value)"

Please Solve this one

Thanks

Syed Haider Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top