Passing date ranges from combo box to txt

yeasir01

Registered User.
Local time
Today, 00:01
Joined
Mar 26, 2018
Messages
67
Hello,

I'm trying to pass a VBA snippet that stored in a table into two text box from a single combo box. The VBA code I'm using is as followed in the after update of the combo box. The problem I'm having is instead of setting the value, it is passing the value as a string. for example "Date()" for today instead of 5/14/2018. Any Ideas?

Code:
me.txt_start = cmb_daterange.column(2)
me.txt_end = cmb_daterange.comun(3)

The table stores the following
ID, Description, Start Code, End Code
 
Should return the actual date value.
Is string "date()" is being returned you can use eval() function to return the date:

If instr(me.mb_daterange.column(2) & "", "Date()") > 0 then
me.txt_start = Eval(cmb_daterange.column(2))
Else
...
 
Should return the actual date value.
Is string "date()" is being returned you can use eval() function to return the date:

If instr(me.mb_daterange.column(2) & "", "Date()") > 0 then
me.txt_start = Eval(cmb_daterange.column(2))
Else
...

Thank You! That did the trick
 
Should return the actual date value.
Is string "date()" is being returned you can use eval() function to return the date:

If instr(me.mb_daterange.column(2) & "", "Date()") > 0 then
me.txt_start = Eval(cmb_daterange.column(2))
Else
...

Sorry jumped the gun on that one it doesn't seem to work for codes such as the one below.

Last Month(start): DateSerial(Year(Date), Month(Date) - 1, 1)
Last Month (end): DateSerial(Year(Date), Month(Date), 1) - 1
 
If you want reusable code, create procedures or functions in a standard module and call them.
 

Users who are viewing this thread

Back
Top Bottom