Randomblink
The Irreverent Reverend
- Local time
- Today, 15:25
- Joined
- Jul 23, 2001
- Messages
- 279
With lstGenericDELETE
.ColumnCount = 4
.ColumnWidths = "0in;0in;1in;1.3in"
.RowSource = "SELECT DISTINCT [tbl_LINK_ProjectBasics-Employee].[Empl_ID], [tbl_LINK_ProjectBasics-Employee].[Proj_ID], " & DLookup("[Empl_FirstName]", "tbl_Employee", "[Empl_ID] =" & [Empl_ID]) & "AS FirstName, " & DLookup("[Empl_LastName]", "tbl_Employee", "[Empl_ID] =" & [Empl_ID]) & "AS LastName, " & "[FirstName]" & " " & "[LastName]" & " AS Employee, " & DLookup("[Dept_ID]", "tbl_Employee", "[Empl_ID] =" & [Empl_ID]) & "AS DeptLook, " & DLookup("[Dept_Name]", "tbl_Department", "[Dept_ID] =" & [DeptLook]) & "AS Department FROM [tbl_LINK_ProjectBasics-Employee] WHERE ((([tbl_LINK_ProjectBasics-Employee].[Proj_ID])=[Forms]![mstrfrm_ProjectBasics]![Proj_ID]));"
.Tag = "DELETE ProjectBasicEmployee"
End With
If you will check out the attached GIF, it shows the relationships I am using...
The above lines of code are being used to attach a Rowsource to a ListBox.
The idea is:
I have a form called mstrfrm_ProjectBasics.
I have it's RecordSource set to: tbl_ProjectBasics.
As I move from Project to Project, I want to use this list box for various things, but when I click a button, I want the listbox to show all of the employees assigned to this Project...
Now then, when I create the listbox control on the form in Design View, and I manipulate the Rowsource by clicking on the [...] button on the Properties box, I get a Query creator...
I create the Query, it works just like I want it to, so I view the SQL code and cut and paste...
Well, the code at the start is Cut-And-Pasted and it doesn't work...
Can someone help me with why?
It keeps giving me one of the two following run-time errors:
Microsoft Access can't find the field 'Forms' referred to in your expression.
or
Microsoft Access cant find the field '|' referred to in your expression.
What am I doing wrong...????
.ColumnCount = 4
.ColumnWidths = "0in;0in;1in;1.3in"
.RowSource = "SELECT DISTINCT [tbl_LINK_ProjectBasics-Employee].[Empl_ID], [tbl_LINK_ProjectBasics-Employee].[Proj_ID], " & DLookup("[Empl_FirstName]", "tbl_Employee", "[Empl_ID] =" & [Empl_ID]) & "AS FirstName, " & DLookup("[Empl_LastName]", "tbl_Employee", "[Empl_ID] =" & [Empl_ID]) & "AS LastName, " & "[FirstName]" & " " & "[LastName]" & " AS Employee, " & DLookup("[Dept_ID]", "tbl_Employee", "[Empl_ID] =" & [Empl_ID]) & "AS DeptLook, " & DLookup("[Dept_Name]", "tbl_Department", "[Dept_ID] =" & [DeptLook]) & "AS Department FROM [tbl_LINK_ProjectBasics-Employee] WHERE ((([tbl_LINK_ProjectBasics-Employee].[Proj_ID])=[Forms]![mstrfrm_ProjectBasics]![Proj_ID]));"
.Tag = "DELETE ProjectBasicEmployee"
End With
If you will check out the attached GIF, it shows the relationships I am using...
The above lines of code are being used to attach a Rowsource to a ListBox.
The idea is:
I have a form called mstrfrm_ProjectBasics.
I have it's RecordSource set to: tbl_ProjectBasics.
As I move from Project to Project, I want to use this list box for various things, but when I click a button, I want the listbox to show all of the employees assigned to this Project...
Now then, when I create the listbox control on the form in Design View, and I manipulate the Rowsource by clicking on the [...] button on the Properties box, I get a Query creator...
I create the Query, it works just like I want it to, so I view the SQL code and cut and paste...
Well, the code at the start is Cut-And-Pasted and it doesn't work...
Can someone help me with why?
It keeps giving me one of the two following run-time errors:
Microsoft Access can't find the field 'Forms' referred to in your expression.
or
Microsoft Access cant find the field '|' referred to in your expression.
What am I doing wrong...????