Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data entry form: Textbox value from query from table 1

Status
Not open for further replies.

CapnOats

Programmer
Apr 15, 2004
35
GB
Hi all,

The problem I am having is with a data entry form in my database. The form is used to update hours worked on a job.

First a siteReference is chosen from a combo box called "seRefText".

This then fills another combo box, "fmRefText", with all the possible jobs for this site.

The designer, "techCombo", is then picked from a list. I then want to fill a text box with the current hours worked which could be retrieved by the SQL Query below.

Code:
SELECT Work.[Hours Worked]
FROM Job
WHERE
Work.[SE Reference] = [seRefText] AND
Work.[FM Reference] = [fmRefText] AND
Work.[Designer] = [techCombo];

Could anyone shed some light on how this could be done? I have already tried to find something like the "Row Source" in a combo box, but to no avail. I know there will only be one possible record returned due to the primary keys, but I'm just not sure how to get it to fill in the box.

Thanks in advance,
Mike Coats
 
In the techCombo 's AfterUpdate event :-

Dim rst As ADODB.Recordset
etc.

rst.OPEN "SELECT Work.[Hours Worked] As HW
FROM Job
WHERE
Work.[SE Reference] = [seRefText] AND
Work.[FM Reference] = [fmRefText] AND
Work.[Designer] = [techCombo];"

If rst.EOF then
textboxname = 0
Else
textboxName = rst!HW
End If




'ope-that-'elps.





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
I actually managed to do it by using combo boxes for all the input boxes and fudging a few queries here and there.

Next time I want to do it cleanly, ill keep your tip in mind. It looks like it does exactly what I want.

Thanks very much.
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top