473,804 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Query in a Form Control

76 New Member
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_t ime 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
2 2007
kcddoorman
76 New Member
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
kcddoorman
76 New Member
DLOOKUP ! YAY
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("sku","employees","ID = [employee]")
Dec 26 '07 #3

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

Similar topics

3
29022
by: MX1 | last post by:
I have a query written in MS Access that has a few calculated fields. Is it possible to refer to that query in a form field. I'd like the form field to show the sum of one of the columns from the query I've written. I've tried to put the following in the form field's control source property but I'm getting an error. Query1 is the name of the query and CalculatedTotal is the calc'd field column I'm trying to get a total for in the form...
5
3132
by: Ken Lindner | last post by:
We have a report based on a query that is called from a form. Nothing too special here. The query has 3 coulmns that are populated directly from values entered into entry fields on the form that calls the report using syntax such as "StartDate: !!" in the field value of the column. This also reads as "!! AS StartDate" in the SQL design view.
2
4409
by: Seth Delaney | last post by:
I have a form with multiple unbound text boxes which serves as a "search form". I can enter my search parameters in the various boxes as needed and click okay. My records are then filtered to produce the results I want in a separate form (filter by form). No problem, except I want to save the sql to a query, not a form. When I debug.print the various sql, I get something like this example: (( LIKE "cam*")) which obviously is not enough...
1
1490
by: Joe.Mobley | last post by:
All, When you sell a product we require access to remove that information from the stock table, so the product is sold througha comobo box named "Combo4" under the prodcuts sold form which is a sub-form of the form Appointments. When creating the update query I used the -1 to redcue the number of avaliable items in stock, but Access prompts for the name of the item you wish to remove, so how do you tell Access to get this
7
9269
by: John | last post by:
I currently have a form and subform based on two tables; tblGoodsIn and tblGoodsInDetail. The fields in the underlying tables do not contain any price information. only foreign key links to product and price tables. I use combo boxes to select parts and prices. I want the form to calculate totals as I enter the data so I can check instantly that what I am entering into the database tallies with the supplier Invoice. . I tried doing...
2
41297
by: | last post by:
Hi everyone, I have a form with a combo box on it. When you select a value (a PO#) from the combo box, the bound field is the indexID of the selected PO. On the same form, I have a text box that I'd like to feed from a query I've built. The query does some math and comes up with a number (qty allocated) for the selected PO. There are two tricky parts here. That query I've built needs to filter on the indexID that gets selected from...
10
2854
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone know a solution for this? Thanks!
2
4000
by: dath | last post by:
Hi, Searched the forum and found a lot on passing form input to aquery but not the other way around. Here is the situation: I have a timesheet form based on a subform query that asks the user for the Month and their last name. The fields in the table being updated include: FY, Month, Employee ID, Task Number, hours. The query then displays the results in data sheet view on the form. I have been asked by users to display total they...
6
6871
by: Phil Stanton | last post by:
I am running a query that calls a function used to format addresses depending on the width of a control on a report that shows that address. The same query is used as the RecordSource of lots of similar reports, but all with different sized Address text boxes. For the function to work, the report need to be open in design view, so that the Text Box Width can be "measured". The function is obviously called for each line of the query (about...
2
2116
by: Coll | last post by:
I have a form and a query. I would like to have some control on the form (check box probably), that when selected will limit the criteria for a field in a query. Here are the details.... When the checkbox (or whatever control is appropriate on the form) is checked, the field "employment_category" in my query will have the following criteria - not "temp" and not "diem" - I've tried several things, but I can't seem to figure out how to...
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.