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 <--