G
Guest
Doug,
Nothing's there.
--
tmdrake
Nothing's there.
--
tmdrake
Douglas J. Steele said:So exactly what's in strSQL when you're assigning it as the RecordSource?
Put
Debug.Print strSQL
in your code directly in front of the line
Me.Project_Staffing_Resources_subform.Form.RecordSource = strSQL
then go to the Immediate window (Ctrl-G) to see what's there.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
tmdrake said:Doug,
Now that I've made the change (inserting the space), when I hit the Select
button, two parameter boxes popup, one asking for the last name and the
another asking for the first name. Once this information is entered, I
get a
error message stating "You canceled the previous operation".
How do I fix this?
Thanks
--
tmdrake
Douglas J. Steele said:The code
& "[tblProject Staffing Resources].EmployeeID" _
& "FROM [tblProject Staffing Resources] WHERE True"
means that the resulting SQL will be:
[tblProject Staffing Resources].EmployeeIDFROM [tblProject Staffing
Resources] WHERE True"
It needs to be
[tblProject Staffing Resources].EmployeeID FROM [tblProject Staffing
Resources] WHERE True"
which means that your code needs to be
& "[tblProject Staffing Resources].EmployeeID " _
& "FROM [tblProject Staffing Resources] WHERE True"
(Note the space between the D and the closing quote in the first line)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hi Doug,
I'm not sure what you mean. I tried inserting a space after the last
field
name, however I still get the same error message. Please explain.
Thanks
--
tmdrake
:
You're missing a space between the last field name ([tblProject
Staffing
Resources].EmployeeID) and the keyword FROM.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
John,
Here is the code:
Private Sub Select_Click()
Dim strSQL As String
strSQL = "SELECT [tblProject Staffing Resources].ProjectID, " _
& "[tblProject Staffing Resources].DisciplineName, " _
& "[tblProject Staffing Resources].SectionNumber, " _
& "[tblProject Staffing Resources].[Staff Last Name], " _
& "[tblProject Staffing Resources].[Staff First Name], " _
& "[tblProject Staffing Resources].[Discipline Lead], " _
& "[tblProject Staffing Resources].[Est Project Start Date], " _
& "[tblProject Staffing Resources].[Est Project End Date], " _
& "[tblProject Staffing Resources].EmployeeID" _
& "FROM [tblProject Staffing Resources] WHERE True"
If Not IsNull(Me![DisciplineName]) Then
strSQL = strSQL & " AND [DisciplineName] = '" & Me![DisciplineName]
&
"'"
End If
If Not IsNull(Me![SectionNumber]) Then
strSQL = strSQL & " AND [SectionNumber] = '" & Me![SectionNumber] &
"'"
End If
If Not IsNull(Me![ProjectID]) Then
strSQL = strSQL & " AND [ProjectId] = '" & Me![ProjectID] & "'"
End If
If Not IsNull(Me![LastName]) Then
strSQL = strSQL & " AND [LastName] = '" & Me![LastName] & "'"
End If
CREATING THE ERROR MESSAGE:
Me.Project_Staffing_Resources_subform.Form.RecordSource = strSQL
Thanks