[AccessD] A2002: DateAdd From a Combo box

Darren darren at activebilling.com.au
Wed Nov 28 06:47:41 CST 2012


Hey Andy,
Thanks for the reply
Mate, life is brilliant - livin' the dream - how could you not, when living
here in paradise (And no - Still no passport :-))

I tried this

	Dim dtNewDate 
	Debug.Print Me.cmbUpdateDueDate.Column(2)
	dtNewDate = Eval(Me.cmbUpdateDueDate.Column(2))
	MsgBox dtNewDate

This is the result of the debug.print 
	DateAdd("m", 3, NextDueDate)

Anyway - I got an error error about the field NextDueDate not being found.
But It does exist
If I write .......Msgbox DateAdd("m", 3, NextDueDate) 
in the immediate window - I get a result
I even tried tried adding 'Me.' In front of the Field Name in the stored
Date Add - no Joy there either

Many thanks

Darren


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Wednesday, 28 November 2012 6:41 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A2002: DateAdd From a Combo box

Hi Darren, old sport, how're you doing

Another thought, and I've not tried it, but could you Eval the second column
of the combo value they select? Something like:

NewDate = Eval(me.combo.column(1))

As I say I haven't tried it but might have legs.

Cheers

Andy

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: 28 November 2012 01:19
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A2002: DateAdd From a Combo box


Yes, much more compact.   

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Tuesday, November 27, 2012 4:47 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2002: DateAdd From a Combo box


I'd build the combobox with 3 columns - 2 with length 0 so that they don't
display.

 Every Day; "d"; 1
Every Week; "ww";1
Every Month; "m"; 1
Every 3 months; "m", 3
Every 6 months; "m", 6

Then make
txtNewDate = DateAdd(combo.column(2),combo.column(2),Date())

--
Stuart

On 27 Nov 2012 at 16:29, Rocky Smolin wrote:

>  
> I'd use the Select Case Function.  In your combo - 2 columns - width 
> 0";1.5"; row source:
> 
> 1;Every Day;2;Every Week;3;Every Month;...etc.
> 
> Then in the After Update event of the combo box
> 
> Select Case Me.ComboBox
>      Case 1
>           Me.txtNewDateDue = DateAdd("d",1,NextDueDate)
>      Case 2
>           Me.txtNewDateDue = DateAdd("d",7,NextDueDate)
>      .
>      .
>      .
>      .
>      .
> End Select
> 
> That work?
> 
> Rocky
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren
> Sent: Tuesday, November 27, 2012 4:04 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] A2002: DateAdd From a Combo box
> 
> Hi David and Rocky
> 
> Thanks for the swift replies.
> 
> David, I may need to look at your method.
> Problem is, general users will be 'adding or editing' these items for 
> the combo (via a popup).
> So I think it would mean writing more code (mids and lefts etc.) to 
> determine the bits (Integers/months) from the Date Add function.
> I don't really want them doing the individual data entry for the 
> integers/months. The DateAdd edits are more than enough.
> 
> Rocky, yes that's what I'm trying to do -  without the case functions. 
> So something like...
> 
> Me.txtNewDateDue = DateAdd("m", 2, Now())
> 
> Works fine - But how do I do...
> 
> Me.txtNewDateDue = Me.cboDateAddValue.Column(1)
> 
> Many thanks in advance
> 
> Darren
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky 
> Smolin
> Sent: Wednesday, 28 November 2012 10:41 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] A2002: DateAdd From a Combo box
> 
> How about a hidden column in the combo box with a sequence number and 
> when the user selects one from the combo box, in the after update 
> event put a Select Case and run the Date Add that you want?
> 
> Rocky
>  
> 
> -----Original Message-----From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren
> Sent: Tuesday, November 27, 2012 3:08 PM
> To: AccessD
> Subject: [AccessD] A2002: DateAdd From a Combo box
> 
> Hi Y'all
> 
> I am storing some DateAdd functions in a 2 column table to give users 
> a list of choices for automatically creating a new "next due date"
> Values in the table look like this
> 
> DateAddDescription   DateAddvalue
> -----------------------------------------------------
> Every Day                     DateAdd("d",1,NextDueDate)
> Every Week                  DateAdd("d",7,NextDueDate)
> Every Month                DateAdd("m",1,NextDueDate)
> Every 3 Months           DateAdd("m",3,NextDueDate)
> Every 6 Months           DateAdd("m",6,NextDueDate)
> 
> When a user selects one of these items from the combo I'd like the 
> actual Date Add function selected, to be applied to the actual "next 
> due date" on the form Assume the "next due date" is blank in a new 
> record, once a user selects a value from the combo, say....the 4th one
>       DateAdd("m",1,NextDueDate)
> I'd like the new due date on the form to be "2013-2-28"
> Make sense?
> Many thanks in advance
> Darren
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list