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  

assigning a value from a column of a combo



 
 
Thread Tools Display Modes
  #1  
Old April 2nd, 2009, 05:08 PM posted to microsoft.public.access.forms
2vao
external usenet poster
 
Posts: 18
Default assigning a value from a column of a combo

Hello,

I have a combo called Ldg (number) and textbox called ArrDate, TxtUt,TxBd
Ldg- Row source -querie; N0 of Column: 5; 1st Col set to 0; 5th column dates
(Descending); list row = 2 ; Column Heads No
ArrDate : short date (dd-mm-yy)
I want to assign value to TxtUt and TxtBd based on comparison between Ldg
5th Column and ArrDate. Here is my code

Private Sub ArrDate_AfterUpdate()

Me.Ldg.Requery
Me.Ldg.Value = Me.Ldg.ItemData(0)
If Format(Me![Ldg].Column(4),"mm-dd-yy") Format(Me![ArrDate],"mm-dd-yy" then
Me.Ldg.Value = Me.Ldg.ItemData(1)
Me.TxtUt.Value = Me.Ldg.Column(2)
Me.TxtBd.Value = Me.Ldg.Column(3)
Else
Me.Ldg.Value = Me.Ldg.ItemData(0)
Me.TxtUt.Value = Me.Ldg.Column(2)
Me.TxtBd.Value = Me.Ldg.Column(3)

End if
End Sub.

My problem is that TxtUt and TxtBd always get the value from ItemData(0).
Kindly help.
Many thanks.





  #2  
Old April 2nd, 2009, 07:04 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default assigning a value from a column of a combo

I would add a breakpoint in that procedure so as to be able to step through
it, line by line, and see what it is doing.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"2vao" wrote in message
...
Hello,

I have a combo called Ldg (number) and textbox called ArrDate, TxtUt,TxBd
Ldg- Row source -querie; N0 of Column: 5; 1st Col set to 0; 5th column
dates
(Descending); list row = 2 ; Column Heads No
ArrDate : short date (dd-mm-yy)
I want to assign value to TxtUt and TxtBd based on comparison between Ldg
5th Column and ArrDate. Here is my code

Private Sub ArrDate_AfterUpdate()

Me.Ldg.Requery
Me.Ldg.Value = Me.Ldg.ItemData(0)
If Format(Me![Ldg].Column(4),"mm-dd-yy") Format(Me![ArrDate],"mm-dd-yy"
then
Me.Ldg.Value = Me.Ldg.ItemData(1)
Me.TxtUt.Value = Me.Ldg.Column(2)
Me.TxtBd.Value = Me.Ldg.Column(3)
Else
Me.Ldg.Value = Me.Ldg.ItemData(0)
Me.TxtUt.Value = Me.Ldg.Column(2)
Me.TxtBd.Value = Me.Ldg.Column(3)

End if
End Sub.

My problem is that TxtUt and TxtBd always get the value from ItemData(0).
Kindly help.
Many thanks.







 




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 10:57 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.