setvalue

W

Weezul

I have a data base that contains employee information. it
also contains the Contractor name that employee works for.

I want to be able to double click on Contractor field of
the employee form and return the Contractor Information
Form.

When I use the set value function I don't know how to
return that value to the "Find Contractor" query.

Any help would be appreciated.

TIA
 
K

Ken Snell

I'm not clear on how you're using the SetValue action in this scenario.
Please provide more details.
 
G

Guest

Hi Ken,

I guess I'm not using the correct command to do what I
want. I though that the setvalue command returns the
information in that particular field. Upon further
reading I find that I am incorrect. I now know I should
not be using setvalue at all... I just don't know how to
do what I want.

I guess the easiest way to explain it is, I have a field
that has a value in it. I want to take that value and
look up the equivalent record in another table.

In otherwords, I have a form with the employee
information. I want to be able to double click the field
containing his employer name and in return the form for
that particular employer information comes up.

I even tried GoToRecord command but I don't know how to
make the information of the current field the
destinatioin for the GoToRecord command.

Thanks for your help. I really appreciate it.
 
K

Ken Snell

Create a query that will select the information you want for the "employer
information" form.

In the criteria box under the employer name, put an expression like this:
Forms!NameOfFirstForm!NameOfEmployerNameTextbox

Save the query.

Use this query as the RecordSource of the "employer information" form.

Now, assuming that you've coded a macro or VBA code on the textbox's
OnDblClick event that will open the "employer information" form, all should
work ok.
 
W

Weezul

Hi Ken,

Thank you for the great idea. I applied it, to the best
of my knowledge and I think I'm still doing something
wrong.

Here's what I got. Employee form (frmEmployee) and a
Contractor form (frmContractor) and a query
called "qryFindContractor" and turned that into a form
called "frmFindContractor" like you specified.

I did indeed create a Macro that initiates the Double
Click command opening the "frmFindContractor". Now when I
double click on the text box containing the Contractor ID
on the current employee form I get a dialogue box asking
me to enter the ContractorID code, what I'd like is for
this to automatically get that number from the current
OPEN employee's form text box called "ContractorID".

Believe me... I really appreciate your help. I hate to
keep asking...

Desperately Useless over here
 
K

Ken Snell

Post the SQL statement of the qryFindContractor query (open it in design
view, then click on Views icon at top left and select SQL view, copy and
paste here the SQL statement).

I'm pretty sure that the criterion expression is not quite right.
 
W

Weezul

Hi Ken,

Here is the SQL statement.

SELECT tblContractor.ContractorID,
tblContractor.ContractorName, tblContractor.Address,
tblContractor.City, tblContractor.StateOrProvince,
tblContractor.Notes
FROM tblContractor;
 
K

Ken Snell

I don't see any criterion expression in your SQL statement?

Try this:

SELECT tblContractor.ContractorID,
tblContractor.ContractorName, tblContractor.Address,
tblContractor.City, tblContractor.StateOrProvince,
tblContractor.Notes
FROM tblContractor
WHERE tblContractor.ContractorID =
[Formst]![frmEmployee]![ContractorID];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top