Using form for searching, and then for changing records

S

Smoki

Hello,
I need to make form, which I will use first to search from tables, and when
I find it, I need to change some paramethers about it. How to do this?
I already made form, but when I change some paramethers, then this
paramethers has been changed on every place in table, not only in that
specific row!
What to do?

Smoki
 
S

Stefan Hoffmann

hi Smoki,
Hello,
I need to make form, which I will use first to search from tables, and when
I find it, I need to change some paramethers about it. How to do this?
I already made form, but when I change some paramethers, then this
paramethers has been changed on every place in table, not only in that
specific row!
What to do?
Use two forms, one for searching and one for editing the data. In the
search form use a continuous form with a form header and footer. In the
header you can place your search boxes (e.g. txtSearchName), and in the
footer the edit buttons (e.g. cmdEdit). Use the On Change event of the
box to narrow down your results:

Private Sub txtSearchName_Change()

Dim Criteria As String

Criteria = Replace(Nz(txtSearchName.Value, ""), "'", "''")
Criteria = "[Name] LIKE '*" & Criteria& "*'"

Me.Filter = Criteria
Me.FilterOn = True

End Sub

Use the buttons Click event to open your form:

Private Sub cmdEdit_Click()

Dim Criteria As String

Criteria = "[Id] = " & Me![Id]
DoCmd.OpenForm "frmEditData", , ,Criteria

End Sub


Take a closer look at the OpenForm method and use the criteria
parameter, not the filter parameter (the position in the parameter list
is important, otherwise use named parameters).

Your record source of the search form must include in this example at
least a [Name] field and an [Id] field - the primary key field.

If you are using Access 2007 you may use a split form instead.

mfG
--> stefan <--
 
K

KARL DEWEY

but when I change some paramethers, then this paramethers has been changed
on every place in table,
I bet this is not true. Check the data in the table directly, not using a
form or query, but opening the table and looking at that field (normally you
would not do this) I think you will find the data has not changed.
You see I am sure you did not bind the textbox to the field.

Post the Record Source for the form. Open in design view, right click and
scroll down to select Properties. If the Record Source is a query then open
the query in design view, click on VIEW - SQL View, highlight all, copy, and
paste in a post.
 

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

Similar Threads


Top