A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DLookup - why this syntax?



 
 
Thread Tools Display Modes
  #11  
Old February 14th, 2010, 06:53 AM posted to microsoft.public.access.forms
Ron[_23_]
external usenet poster
 
Posts: 27
Default DLookup - why this syntax?

Note that neither a DLookUp nor a text literal will be updateable...

So far it's working. I have the DLookup executing from the main form change
event (only if record is not new) and from the subform combobox's
after_update. I need to add a few more dummy records and make sure all
contingencies are covered.

If you're having trouble post the SQL view of the form and subform's
recordsource and a bit more information about what you're trying to
accomplish.


Thank you! You actually helped me already in another thread.

Having a single textbox on a mainform dependent on a combo box on
a subform (which could represent thousands of records) seems suspect to
me!


It's a conceit really. The app is for my wife's hobby jewelry business.
The subform's record source is a query run on the join table between Items
and Status. The subform has a combobox for status (eg. construction
finished, for sale, placed on consignment, sold, etc. - just a few, not
thousands) and a text box formatted for date (when the status changed). The
subform is to track the progress of jewelry making , from construction
through sale, for each item in inventory. So every time an item's status
changes, she can add a record to the subform, choosing status in the combo
box and the date in the text box. The conceit of the text boxes on the
*main form* is to show the status with the *latest* date - ie. the latest
entry in the subform. Just for easy visualization in the main form as she
scrolls through the inventory. It's not necessary, but it improves the
esthetics, and I wanted to learn how to do it. You helped by pointing me to
the notion of a query with a subquery using DMax. I run that on the join
table from which the subform is generated. That gives a dataset with only
the *latest* status and date for each item of jewelry (of which there'll
probably never be more than several hundred), and that becomes the domain of
the DLookup, whose criteria gives the row for the *current* item of jewelry
in the main form. Hope that conveys the flavor of the project.

No immediate coding issue that I can see. I'm sure there'll be more as I
implement tabs or new forms for other tables in my design (suppliers,
customers, craft show contacts, etc.). Thanks for the offer. Will post if
new issues arise. -Ron

Incidentally, the original motivation behind all this - aside from the
simple kick I get from it - is to create a prototype of a data-driven
website. I thought to model a MySQL/PHP app from it. But I see now that
Access 2010 will have direct website capability. I'm hoping that will make
the process even easier. (Those "where's my website?" questions are getting
a tad more frequent... )

  #12  
Old February 14th, 2010, 07:10 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default DLookup - why this syntax?

On Sun, 14 Feb 2010 01:53:21 -0500, "Ron" wrote:

The conceit of the text boxes on the
*main form* is to show the status with the *latest* date - ie. the latest
entry in the subform. Just for easy visualization in the main form as she
scrolls through the inventory.


Sounds like a very nice touch. Thanks for the explanation!
--

John W. Vinson [MVP]
  #13  
Old March 11th, 2010, 04:44 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default DLookup - why this syntax?

Yes but there are form variables and Dim'd variables. They take similar but
slightly different syntax.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Ron" wrote in message
...
Ok, thanks. But isn't the the first parameter also a variable? I guess
what it comes down to is that the function "knows" that parameter will
always be a field name, so the quotes requirement is simply "protocol."
(Just trying to get some insight into designation convention. Gotta read
more.)

Thanks. -Ron

"Arvin Meyer [MVP]" wrote in message
...
Because you are using a variable, not a value. The variable hold the
value, but is not itself the value. If you were to use a variable from
the code instead of from the form it would look like:

=DLookUp("[fldStatus]","QryforCurrentStatusTxtBox","QryforCurrentStatus txtBox.ItemsID
= " & lngID
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Ron" wrote in message
...
After a couple frustrating weeks - typos and my own ignorance - I
finally got a functioning control source for a textbox (and it works as
desired LOL) :

=DLookUp("[fldStatus]","QryforCurrentStatusTxtBox","QryforCurrentStatus txtBox.ItemsID
= " & [Forms]![frmMainForm].[id])

The generic formulations for DLookup that I see in books has the entire
criteria parameter in quotes. I put the quotes as shown, because that's
how I've seen it done here and elsewhere (without explanation for the
syntax). My (very noob) question is: Why is this concatenation
necessary?

-Ron







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.