Khartoum,
You don't need a WHERE clause in the SQL since you are opening the form with
the optional WHERE parameter.
I created a table named LPF Errors and loaded two records with the UserName
= "Smith, John". If I paste your SQL into a new query, it returns both
records. If I cut and paste it into the RecordSource of a form, the form
displays both records.
I can't explain why your form is not displaying all records matching the
UserName, unless the UserName is a text field and the entries are not an
exact match, such as:
Smith, John
Smith,John
Smith John
Smith, John
If this is the case, a combo box that gets its rows from an Employee table
would be a better choice than to trust the user to enter the name correctly.
I am confused about one point. Your last post said that the RecordSource of
the form was "LPF Errors", and yet now you say that the SQL below "runs the
form". Since you cannot name a query the same name as an existing table,
"LPF Errors" must refer to the table, hence the SQL is NOT running the form,
the table is.
Sorry I couldn't help. Perhaps one of the MVPs can jump in here.
Sprinks
Khartoum said:
There are no other filters and there are multiplle records, this is the SQL
for the query that runs the form:
SELECT [LPF Errors].[Error Number], [LPF Errors].UserName, [LPF
Errors].[Action Required], [LPF Errors].[Date of Action], [LPF
Errors].[Review Date], [LPF Errors].[Review Completed]
FROM [LPF Errors];
should there be a where clause in here to filter all occurences of the
username.
Regards Kh
:
Khartoum,
Is it possible that LPF Errors *itself* is filtering the records further,
that is, is it a query that selects for example, only a certain day's records
or some other subset? If you open LPF Errors, are there multiple records
there for John Smith that are *not* displayed when you press your command
button?
Sprinks
:
The form is called LPF Errors and the filter looks correct. It is set as
follows:
Record Source...........LPF Errors
Filter.........................[UserName]='Smith, John'
where John Smith is the record i have open in the LPF Error form
is there something i a missing?
:
Khartoum,
What is the RecordSource of the form? Is it possible that it is filtering
the records beyond the Username field. Also, check the RecordSource itself
to verify that multiple records are there.
The syntax of your procedure looks correct.
Sprinks
:
I have a form with a agents name field which records errors. I added another
form, an agent log so that when i opened it it would display a log of all
that agents errors (like a datasheet) but it is only displaying the 1 record.
See code below, has anybody any ideas how to display all:
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Agent Conflict Log"
stLinkCriteria = "[UserName]=" & "'" & Me![UserName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
End Sub
Thanks Kh