A little help needed

  • Thread starter Thread starter Nate
  • Start date Start date
N

Nate

Can anyone give the macro overview of how to do the following task.

Have an enrty box in which I can enter a record number, search for that
record and that record be displayed in an exsisting form for editing.

Thanks a bunch
 
Records do not have a searchable record number. Any number displayed for a
record is just a sequence number of the order that they are currently
displayed.

Now if you have a field that you are entering a distinctive record
identifier you could search on that field.
 
Karl.....thanks for the info.....

That is what is need to do. I have a feild that I was referring to as
record number. I need to search for that feild and then pull that record up
in a form........but how......

Thanks
 
1. Put an unbound "search" textbox in the forms header or footer. Add a
cmd_Search command button next to it.

2. In the command buttons click event, try something like:

Private Sub cmd_Search_Click

Dim strCriteria as string
dim rs as dao.recordset

strCriteria = "[ID] = " & me.txt_Search
set rs = me.recordsetclone
rs.findfirst strCriteria
if rs.nomatch then
msgbox "ID not found"
Else
me.bookmark = rs.bookmark
endif
rs.close
set rs = nothing

End sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
Dale....That part seemed to work but what do I need to do to get that record
displayed in an exsisting form?

Thanks for the help

Dale Fye said:
1. Put an unbound "search" textbox in the forms header or footer. Add a
cmd_Search command button next to it.

2. In the command buttons click event, try something like:

Private Sub cmd_Search_Click

Dim strCriteria as string
dim rs as dao.recordset

strCriteria = "[ID] = " & me.txt_Search
set rs = me.recordsetclone
rs.findfirst strCriteria
if rs.nomatch then
msgbox "ID not found"
Else
me.bookmark = rs.bookmark
endif
rs.close
set rs = nothing

End sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Nate said:
Karl.....thanks for the info.....

That is what is need to do. I have a feild that I was referring to as
record number. I need to search for that feild and then pull that record up
in a form........but how......

Thanks
 
Do you want to display the record on the same form that you have the search
box on? If so, make sure the RecordSource of the form is the table or query
that has the field in. By the way , if you add a combo box to the form, and
your wizard is active, it will do what you want if you select the bottom
option(Find a Record on My Form based on a value I selected in my combo
box.)

On the other hand if you want to open another form and display the found
value you would need something like the following

DoCmd.OpenForm FormName,,,"[ID] = " & me.txt_Search


Nate said:
Dale....That part seemed to work but what do I need to do to get that record
displayed in an exsisting form?

Thanks for the help

Dale Fye said:
1. Put an unbound "search" textbox in the forms header or footer. Add a
cmd_Search command button next to it.

2. In the command buttons click event, try something like:

Private Sub cmd_Search_Click

Dim strCriteria as string
dim rs as dao.recordset

strCriteria = "[ID] = " & me.txt_Search
set rs = me.recordsetclone
rs.findfirst strCriteria
if rs.nomatch then
msgbox "ID not found"
Else
me.bookmark = rs.bookmark
endif
rs.close
set rs = nothing

End sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Nate said:
Karl.....thanks for the info.....

That is what is need to do. I have a feild that I was referring to as
record number. I need to search for that feild and then pull that record up
in a form........but how......

Thanks

:

Records do not have a searchable record number. Any number displayed for a
record is just a sequence number of the order that they are currently
displayed.

Now if you have a field that you are entering a distinctive record
identifier you could search on that field.
--
KARL DEWEY
Build a little - Test a little


:

Can anyone give the macro overview of how to do the following task.

Have an enrty box in which I can enter a record number, search for that
record and that record be displayed in an exsisting form for editing.

Thanks a bunch
 
As Powderfinger said, if you want to pull the record up in the form you're
currently in, let Access do the work for you! Here's a step-by-step:

Add a combo box to your form. The Combobox Wizard will pop up

Select "Find a record based on the value I selected in my combobox."

From the table/query the form is based on, click on the field you're
searching by (your record number field) to move it to the right side.

Hit Next.

Size the column appropriately.

Hit Next.

Name the combobox.

Hit Finish.

Now you can drop the combobox down and scroll down to the item to search by,
or you can start to enter the item, and the combobox will "autofill" as you
type. Hit <Enter> and the record will be retrieved.
 
Back
Top