ClearlyAnIdiot
Registered User.
- Local time
- Today, 09:47
- Joined
- Aug 22, 2013
- Messages
- 39
I have a piece of code, and when it's run, the system doesn't detect any syntax errors.
However, as far as I can see, it does absolutely nothing. I had a tonne of syntax errors before, but after correcting them all, it does nothing.
There are two tables. One is that of the companies, which has its related form open, and the other is that of a child table of a company and its related people. I want it so that the dlookup will look for all the "name" and "rolesperformed" records of things in the 2nd table where the company number is the same as the one in the form, which is my primary key.
How can I get it to display both of those upon clicking? It doesn't really matter to me how they're displayed, as long as they are. Presently, when I click on the command button "lookup", it doesn't do anything.
However, as far as I can see, it does absolutely nothing. I had a tonne of syntax errors before, but after correcting them all, it does nothing.
There are two tables. One is that of the companies, which has its related form open, and the other is that of a child table of a company and its related people. I want it so that the dlookup will look for all the "name" and "rolesperformed" records of things in the 2nd table where the company number is the same as the one in the form, which is my primary key.
Code:
Private Sub Lookup_Click()
Dim Derpy As Variant, Derpie As Variant
Derpy = DLookup("[Name]", "Company-personID", _
"CompanyNo = " & [Forms]![Company info]![CompanyNo])
Derpie = DLookup("[RolesPerformed]", "Company-personID", "CompanyNo = " & [Forms]![Company info]![CompanyNo])
CombinedFields = [Derpy] & [Derpie]
End Sub