Can you use Dlookup like this

XaloRichie

Registered User.
Local time
Today, 04:54
Joined
Jul 2, 2003
Messages
70
Is it possible to use Dlookup to enter a value into a textbox on a form and then save the value it passed to the text box into a record in a table?

Is it also Possible to do the same thing with text box and pass the value to a query criteria?

So in the first instance you lookup the customers name using an ID already on form and this fills the text box on the form with the name wich can be used to update a recordset.

And secondly That a DLookedup field value can be passed to a query as the criteria.

Not all at the same time!
 
Both are possible, but not very logical. If you have a value stored in one table, why would you also want to store it in another?

On the matter of the query, if you have the ID, why not use that as your criterion, rather than the value?
 
The first part to your question seems to be "overdoing it", so to speak as, if you can calculate a value on your form with an expression or function, then you should be able to calculate it any time on your form and there's no need to store a calculable value in your table. I'm sure you have your reasons, though. ;)

As for the second question: yes!

On your query, you can set the criteria to the textbox like this:

[Forms]![frmNameOfForm]![txtNameOfTextbox]
 
Ok The User Selected the customer previously at an input box which may have been a barcode scan.. on click ..The current "New Order Form" opens and it is passed the customerID That was previously selected. On this form Other data is also passed to unbound textboxes Via functions.

What I want to do is

Gather the values from the unbound textboxes. and perform calculations to produce the data to be saved to an orders table using a recordset.
EG !CustID=custid !Tot = Tot ( calculated on form from passed values)Item*Rate

Does it seem more logical now or do i need a Dr :o
 
You shouldn't store the result of a calculation without very good reason. Why can't you use bound forms?
 
Suppose you have a function that calculates The gross figure from a net figure(entered on form) and you want to store the gross figure in your (sales) table along with other fields. What would you bind to ?
 
If you are already storing the fields used to calculate gross, you don't need to also store the result.

In an order processing system, it is necessary to store the item cost at the time the order is placed. To do that, include the cost field in the columns selected for the combo rowsource of the combo used to select product. Then in the AfterUpdate event of the ProductID control put the command that also saves the unitCost -

Me.UnitCost = Me.YourProductIDCombo.Column(?)

? is the column number of the cost field. If you had to had this field, don't forget to update the column count property of the control and keep in mind that the column reference is a 0 based array so .Column(1) actually refers to the second column in the query, .Column(0) refers to the first.
 

Users who are viewing this thread

Back
Top Bottom