Hi to those that care to view this, I'm new here, but I'll try and discribe the task and problem as best I can:
In access I created a form to reference both site workers and the site offices themselves. The form itself ties into the site table (which does not include the staff). I have create a combo box that looks up the staff memeber's names in the Staff table. What I'm trying to do is then use DLookup to refence the site (which is in the staff table) with the staff member selected and put it into a field (which then advances the form to the record for that office - this part works fine, just can't get the DLookup to work)
here is the code I am using:
Me.Combo23.Value = DLookup("[site]", "[FieldStaff DataSheet]", "[staff] = " & Me![Combo27])
break down:
Combo23 is on the form, this is where you select which site office. After selecting a site here, the form moves to that record. This works fine.
FieldStaff DataSheet is the table containing the staff member's information, including what site that are working at.
site is the field in the table that contains the site names
staff is the field in the table that contains the staff member names.
Combo27 This is the selected staff name. It is looked up in the FieldStaff DataSheet table.
when I run the code I get 1 of 2 errors. The first may cause to be a big problem :
Run-time error '3075' Syntax error (comma) in query expression... This seems to be because I have the names as strings "Lastname, Firstname".
I would have just changed the names, but I had a few test names in there without commas. With those I get the error :
Run-time error '2001' You canceled the previous operation.
I must admit that I am rather new to
VB scripting, though I do program in other languages. I have found it rather difficult to look up any information using the Help built in, so I feel kind of stuck here...