473,386 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Syntax to record from a query

135 100+
Hello,

This is VERY basic but i havent do it before.

I have a form that is missing to record in its table one record, as the record displayed when i run the form its just a "=DLookUp("[TCL1]","[PRICING TOTALS V1]") so it doesnt record the value in the table.

I want to write the code so that every time the form opens the table field WILL get that "dlookup" value.

The field name is: totalnom
and the value i want to record (TCL1) is the result of the query PRICING TOTALS V1.

Im trying something like this in the form open but i cant find the correct syntax.

Me.TotalNom.Value = [pricing_totals_v1][TCL1]

Please help.
Gilberto
Sep 20 '07 #1
1 1425
nico5038
3,080 Expert 2GB
Hello,

This is VERY basic but i havent do it before.

I have a form that is missing to record in its table one record, as the record displayed when i run the form its just a "=DLookUp("[TCL1]","[PRICING TOTALS V1]") so it doesnt record the value in the table.

I want to write the code so that every time the form opens the table field WILL get that "dlookup" value.

The field name is: totalnom
and the value i want to record (TCL1) is the result of the query PRICING TOTALS V1.

Im trying something like this in the form open but i cant find the correct syntax.

Me.TotalNom.Value = [pricing_totals_v1][TCL1]

Please help.
Gilberto
You can't store a value in a "bound" field this way as the "=Dlookup()" is in the same position as the field you want to record.
So You'll need to use e.g. the Form's OnOpen event to fill the field with a command like:
Expand|Select|Wrap|Line Numbers
  1. Me!totalnom = DLookUp("[TCL1]","[PRICING TOTALS V1]")
  2.  
But I also need to issue a warning as it looks like you're storing a duplicate value. We *never* store totals in records. We use queries to accurately calculate a Sum of a field when needed. That's called "normalization" and essential to prevent trouble in the future!

Nic;o)
Oct 5 '07 #2

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

Similar topics

3
by: John Pastrovick | last post by:
I use a function, myrandomPIN (), to generate random PIN numbers. The following sql query updates records with the SAME PIN number but. I want to generate DIFFERENT pin numbers for every record....
1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
5
by: ST | last post by:
Hi, I'm sort of in a rush here...I'm sort of new to vb.net and I'm trying to write the syntax to check a sql table to see if the record already exists based on firstname and lastname text fields...
1
by: Dalan | last post by:
I can't seem to find a workaround of Query Syntax Error. Actually, the query performs just fine, except when the last record on a related subform is deleted, then it generates a Runtime Error 3075...
1
by: Dalan | last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually, the query performs as expected when adding any new records or editing existing ones and even deleting records, EXCEPT when the...
2
by: davy d | last post by:
I'm having a problem with an acess form linkin with another form. My index in the main form is Autonumber (Rec#) the 2nd form is called Record# and it is set for text. The link criteria works...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
16
by: Chuck | last post by:
Please help me correct the statements in sub "BoundData" The following sub is in a module. Everything runs with no error messages, however,data is not reaching the text box. Data is being...
2
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.