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

Syntax to record from a query

100+
P: 135
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
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
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

Post your reply

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