Setting the value in a text based on a query result

C

Chris Gorham

Hi,

Simple one...I just want to display a date in a text box based on the result
of a query.
The query works - I select a week number from a dropdown and the query
produces the equivalent date. Now I just need to be able to dsiplay that date
next to the dropdown in a text box
Can't get the code to work...should be simple...just initiate the event when
I change the dropdown...but I can't get the textbox to update with the querie
result

Thanks...Chris
 
P

Paolo

Hi Chris Gorham,
if yourdatetextbox is the name of the text box where you wanna put the
calculated date this should work

yourdatetextbox=yourcalculateddate

HTH Paolo
 
C

Chris Gorham

Nope - can't see how this works...
The text box which will display the date is called "txtbegin" and the querie
whose result is a single date is called "Week Begin1".

The code runs when the drop down is altered and the text box should simply
display the result

Tried code like txtbegin = Query("Week Begin1").value

Doesn't work...Chris
 
P

Paolo

Now I understand a little bit more of what you were saying.
So that, do as follows

if not isnull(dlookup("name of the field of the query you wanna
display","Week Begin1")) then
txtbegin=dlookup("name of the field of the query you wanna
display","Week Begin1")
else
msgbox "The query is empty",48,"Warning"
endif

Cheers Paolo
 
Top