By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,122 Members | 1,641 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,122 IT Pros & Developers. It's quick & easy.

SQL Query in a Form Control

P: 76
Expand|Select|Wrap|Line Numbers
  1. expr1:(SELECT employees.sku from employees where employees.id = [employee];)
This is a subquery sql statement.
Can I get this to work in a text box control in a form?
Employees is a table.
Labor is a table that looks up data from the employee table with this lookup query;
Expand|Select|Wrap|Line Numbers
  1. SELECT employees.ID, employees.name, employees.sku, employees.initials FROM employees; 
The Labor table is being shown in a subform that is filtered by a job number.
I want to show the employees.sku in the subform so it is printed with the rest of the form. I created a text box control that get the time difference from the labor.work_in_time and labor.work_out_time like this;
Expand|Select|Wrap|Line Numbers
  1. =(DateDiff("n",[work_in_time],[work_out_time])\60 & Format(DateDiff("n",[work_in_time],[work_out_time]) Mod 60,"\:00"))
I'm having trouble with getting a sql statement that works in a query to work in a form control. Is there some different syntax or something? Besides wrapping it in parentheses and putting an equals sign in front of it, I'm not sure what I'm missing.
Dec 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: 76
I tried making a query that gives me the needed data and using that as the record source for the sub form but a query doesn't allow you to add new records.
Dec 26 '07 #2

P: 76
DLOOKUP ! YAY
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("sku","employees","ID = [employee]")
Dec 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.