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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

unable to get 2nd & 3rd column value from combobox



 
 
Thread Tools Display Modes
  #1  
Old April 14th, 2010, 01:12 PM posted to microsoft.public.access.gettingstarted
Kaoli
external usenet poster
 
Posts: 13
Default unable to get 2nd & 3rd column value from combobox

I have a unbound combobox(cboPeriod) in header, I call the recordsource from
a table call tblPeriod which contain 3 fields 1st
[Period],2nd[FromDate],3rd[ToDate]

I have a validation which transaction date must within the FromDate and ToDate
but when I do as per below,

Let say in cboPeriod value = 201004(1st Value), 1/4/2010(2nd
value),30/4/2010(3rd Value)
1st Part to fill in the Yearmonth =me.cboperiod is ok, I can get the value
as 201004

but 2nd Part to validate the date with 1/4/2010 & 30/4/2010 I unable to get
the value, which return the value null.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.YearMonth) Then
Me.YearMonth = Me.CboPeriod
Else
End If

If Me.TranDate Me.CboPeriod.column(1) Or Me.TranDate
Me.CboPeriod.column(2) Then
MsgBox "Date not within the Period."
Cancel = True
End If
End Sub


  #2  
Old April 14th, 2010, 09:17 PM posted to microsoft.public.access.gettingstarted
Dorian
external usenet poster
 
Posts: 542
Default unable to get 2nd & 3rd column value from combobox

make sure you have 3 in the 'number of columns' property of the combo box.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"Kaoli" wrote:

I have a unbound combobox(cboPeriod) in header, I call the recordsource from
a table call tblPeriod which contain 3 fields 1st
[Period],2nd[FromDate],3rd[ToDate]

I have a validation which transaction date must within the FromDate and ToDate
but when I do as per below,

Let say in cboPeriod value = 201004(1st Value), 1/4/2010(2nd
value),30/4/2010(3rd Value)
1st Part to fill in the Yearmonth =me.cboperiod is ok, I can get the value
as 201004

but 2nd Part to validate the date with 1/4/2010 & 30/4/2010 I unable to get
the value, which return the value null.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.YearMonth) Then
Me.YearMonth = Me.CboPeriod
Else
End If

If Me.TranDate Me.CboPeriod.column(1) Or Me.TranDate
Me.CboPeriod.column(2) Then
MsgBox "Date not within the Period."
Cancel = True
End If
End Sub


  #3  
Old April 15th, 2010, 03:51 AM posted to microsoft.public.access.gettingstarted
Kaoli
external usenet poster
 
Posts: 13
Default unable to get 2nd & 3rd column value from combobox

Dear Dorian,

Do you mean Column Count?
Yes I already set Column Count 3

"Dorian" wrote:

make sure you have 3 in the 'number of columns' property of the combo box.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"Kaoli" wrote:

I have a unbound combobox(cboPeriod) in header, I call the recordsource from
a table call tblPeriod which contain 3 fields 1st
[Period],2nd[FromDate],3rd[ToDate]

I have a validation which transaction date must within the FromDate and ToDate
but when I do as per below,

Let say in cboPeriod value = 201004(1st Value), 1/4/2010(2nd
value),30/4/2010(3rd Value)
1st Part to fill in the Yearmonth =me.cboperiod is ok, I can get the value
as 201004

but 2nd Part to validate the date with 1/4/2010 & 30/4/2010 I unable to get
the value, which return the value null.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.YearMonth) Then
Me.YearMonth = Me.CboPeriod
Else
End If

If Me.TranDate Me.CboPeriod.column(1) Or Me.TranDate
Me.CboPeriod.column(2) Then
MsgBox "Date not within the Period."
Cancel = True
End If
End Sub


  #4  
Old May 6th, 2010, 04:43 PM posted to microsoft.public.access.adp.sqlserver,microsoft.public.access.gettingstarted
MASEL GOSKOP
external usenet poster
 
Posts: 3
Default unable to get 2nd & 3rd column value from combobox



"Kaoli" schrieb im Newsbeitrag
...
I have a unbound combobox(cboPeriod) in header, I call the recordsource
from
a table call tblPeriod which contain 3 fields 1st
[Period],2nd[FromDate],3rd[ToDate]

I have a validation which transaction date must within the FromDate and
ToDate
but when I do as per below,

Let say in cboPeriod value = 201004(1st Value), 1/4/2010(2nd
value),30/4/2010(3rd Value)
1st Part to fill in the Yearmonth =me.cboperiod is ok, I can get the value
as 201004

but 2nd Part to validate the date with 1/4/2010 & 30/4/2010 I unable to
get
the value, which return the value null.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.YearMonth) Then
Me.YearMonth = Me.CboPeriod
Else
End If

If Me.TranDate Me.CboPeriod.column(1) Or Me.TranDate
Me.CboPeriod.column(2) Then
MsgBox "Date not within the Period."
Cancel = True
End If
End Sub


 




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