Researcher
I.T. Veteran
- Local time
- Today, 14:29
- Joined
- Oct 11, 2006
- Messages
- 42
Hello,
I have two combo boxes which I am trying to declare variables for.
These combo boxes have assigned data in them which I pull from a query.
The first cbo lists events and the 2nd lists dates of the events.
What I would like to do is select the event from the first cbo and have the 2nd cbo list match up the date with the event selected in the first cbo.
Something similar to cascading cbo's.
Also, I do not want the user to be able to randomly select an event and any dates which do not correspond. Here is my sample (poor) code I am working with...
Option Compare Database
Option Explicit
Private Sub Events_BeforeUpdate(Cancel As Integer)
Dim strname As Variant
strname = "Carlos Mencia"
Dim dteDate As Date
dteDate = #3/1/2007#
'Debug.Print Day(dteDate)
' Returns: 4
'Debug.Print Month(dteDate)
' Returns: 5
'Debug.Print Year(dteDate)
' Returns: 1999
'Dim P As String
'Dim Q As String
'Dim R As String
'Dim S As String
'Dim T As String
'Dim U As String
'Dim V As String
'Dim W As String
'Dim X As String
'Dim Y As String
'Dim Z As String
'Dim AA As String
'Dim AB As String
'Dim AC As String
'Dim AD As String
'Dim AE As String
'Dim AF As String
'Dim AG As String
'Dim AH As String
'Dim AI As String
'Dim AJ As String
'Dim AK As String
'Dim AL As String
'O = #3/1/2007#
'P = "03/15/07"
'Q = "03/22/07"
'R = "03/29/07"
'S = "04/05/07"
'T = "04/12/07"
'U = "04/19/07"
'V = "04/26/07"
'W = "05/03/07"
'X = "05/10/07"
'Y = "05/31/07"
'Z = "06/07/07"
'
'AA = "CARLOS MENCIA"
'AB = "ETTA JAMES & THE ROOTS BAND"
'AC = "CIARA WITH NE_YO"
'AD = "SAN MANUEL COMEDY JAM"
'AE = "MUAY THAI(KAENSAK VS. MEHDI ZATOUT"
'AF = "BIG & RICH WITH COWBOY TROY"
'AG = "TWO DIVAS AT THE MOVIES TOUR"
'AH = "PEPE AGUILAR"
'AI = "MIXED MARTIAL ARTS"
'AJ = "KATT WILLIAMS"
'AK = "ASLEEP AT THE WHEEL"
'AL = "VICENTE FERNANDEZ"
If Events.value = strname Then
If EventDate.value = dteDate Then
Exit Sub
End If
End If
End Sub
Any help from the experts is greatly appreciated as I have no hair left to pull..
Thank You,
John

I have two combo boxes which I am trying to declare variables for.
These combo boxes have assigned data in them which I pull from a query.
The first cbo lists events and the 2nd lists dates of the events.
What I would like to do is select the event from the first cbo and have the 2nd cbo list match up the date with the event selected in the first cbo.
Something similar to cascading cbo's.
Also, I do not want the user to be able to randomly select an event and any dates which do not correspond. Here is my sample (poor) code I am working with...
Option Compare Database
Option Explicit
Private Sub Events_BeforeUpdate(Cancel As Integer)
Dim strname As Variant
strname = "Carlos Mencia"
Dim dteDate As Date
dteDate = #3/1/2007#
'Debug.Print Day(dteDate)
' Returns: 4
'Debug.Print Month(dteDate)
' Returns: 5
'Debug.Print Year(dteDate)
' Returns: 1999
'Dim P As String
'Dim Q As String
'Dim R As String
'Dim S As String
'Dim T As String
'Dim U As String
'Dim V As String
'Dim W As String
'Dim X As String
'Dim Y As String
'Dim Z As String
'Dim AA As String
'Dim AB As String
'Dim AC As String
'Dim AD As String
'Dim AE As String
'Dim AF As String
'Dim AG As String
'Dim AH As String
'Dim AI As String
'Dim AJ As String
'Dim AK As String
'Dim AL As String
'O = #3/1/2007#
'P = "03/15/07"
'Q = "03/22/07"
'R = "03/29/07"
'S = "04/05/07"
'T = "04/12/07"
'U = "04/19/07"
'V = "04/26/07"
'W = "05/03/07"
'X = "05/10/07"
'Y = "05/31/07"
'Z = "06/07/07"
'
'AA = "CARLOS MENCIA"
'AB = "ETTA JAMES & THE ROOTS BAND"
'AC = "CIARA WITH NE_YO"
'AD = "SAN MANUEL COMEDY JAM"
'AE = "MUAY THAI(KAENSAK VS. MEHDI ZATOUT"
'AF = "BIG & RICH WITH COWBOY TROY"
'AG = "TWO DIVAS AT THE MOVIES TOUR"
'AH = "PEPE AGUILAR"
'AI = "MIXED MARTIAL ARTS"
'AJ = "KATT WILLIAMS"
'AK = "ASLEEP AT THE WHEEL"
'AL = "VICENTE FERNANDEZ"
If Events.value = strname Then
If EventDate.value = dteDate Then
Exit Sub
End If
End If
End Sub
Any help from the experts is greatly appreciated as I have no hair left to pull..
Thank You,
John