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  

Textbox control source problem



 
 
Thread Tools Display Modes
  #11  
Old February 9th, 2010, 02:12 AM posted to microsoft.public.access.forms
Ron[_23_]
external usenet poster
 
Posts: 27
Default Textbox control source problem


If you want the query to return a value pertaining to the record shown
on
the
current form, then you need to somehow tell Access which record that is!


That much I understand I thought the fact that I have established
persistent relations between the tables establishes just that?! At any
rate, I've tried to explicitly incorporate the relations, but it still
doesn't work for me.


Well... no.

The relationship says that every record in jtblItemsStatus must have a
StatusID field which matches some record in tblStatus. That's ALL THAT IT
MEANS. It doesn't automagically tell a form *which* record that might be.


John, the subform based on the query given in my OP works. If I change a
record on the MainForm, the data in the subform (whose recordsource is a
query built from jtblItemsStatus) change accordingly. It's the ID for *that
parent table* (ItemsID in the join table) for which I want the latest date
record in the jointable so that I may use the FK of tblStatus to lookup the
value of fldStatus.


DLookUp("[QryforCurrentStatusTxtBox]![fldStatus]","[QryforCurrentStatusTxtBox]","[QryforCurrentStatusTxtBox]![ItemsID]=[tblItems]![ID]")

Doesn't work. Something wrong with the criterion part.


Take the criterion out of the quotemarks. Since the only recordset
referenced
inside the DLookUp is the query, there's no need to qualify the
fieldnames:

DLookUp("[fldStatus]", "[QryforCurrentStatusTxtBox]", "[ItemsID]=" &
[tblItems]![ID])

Still doesn't work. Get #Name? error in the control and when I "?" the
function in the debug immediate window I get "External reference not
defined." Tried various syntactical mods, all with same result. When you
say "only recordset referenced inside" you do see that I'm referencing
tblItems, the parent of the join table?

I have a feeling I'm making a very fundamental error here. Forest for trees
kinda deal.

-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 11:43 AM.


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