Click here to Skip to main content
15,884,537 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
ZurdoDev20-Feb-20 4:23
professionalZurdoDev20-Feb-20 4:23 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 4:44
Member 1186689320-Feb-20 4:44 
AnswerRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
ZurdoDev20-Feb-20 5:28
professionalZurdoDev20-Feb-20 5:28 
AnswerRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Richard MacCutchan20-Feb-20 4:58
mveRichard MacCutchan20-Feb-20 4:58 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 5:39
Member 1186689320-Feb-20 5:39 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Dave Kreskowiak20-Feb-20 7:13
mveDave Kreskowiak20-Feb-20 7:13 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 5:42
Member 1186689320-Feb-20 5:42 
QuestionHow to create new DateTime of months, going back 12 months Pin
jkirkerx17-Feb-20 8:32
professionaljkirkerx17-Feb-20 8:32 
How to create new DateTime of months, going back 12 months

I'm writing some reports, that need dynamic months. Months going back a year, 12 Months from the current month.

So like today is Feb 17, 2020

Feb 1, 2020 to Feb 17, 2020
Jan 1, 2020 to Jan 31, 2020
Dec 1, 2019 to Dec 31, 2019
Nov 1, 2019 to Nov 30, 2019
etc

I tried this, M2 would be Jan 1, 2020, M3 would be Dec 1, 2019.
but it crashes on the M3, because the year rolls back to 2019. I get why it crashed.
Dim M2 = New DateTime(Now.Year, Now.Month -1, 1)
Dim M3 = New DateTime(Now.Year, Now.Month -2, 1)
Dim M4 = New DateTime(Now.Year, Now.Month -3, 1)
Dim M5 = New DateTime(Now.Year, Now.Month -4, 1)
Dim M6 = New DateTime(Now.Year, Now.Month -5, 1)
Dim M7 = New DateTime(Now.Year, Now.Month -6, 1)
Dim M8 = New DateTime(Now.Year, Now.Month -7, 1)
Dim M9 = New DateTime(Now.Year, Now.Month -8, 1)
Dim M10 = New DateTime(Now.Year, Now.Month -9, 1)
Dim M11 = New DateTime(Now.Year, Now.Month -10, 1)
Dim M12 = New DateTime(Now.Year, Now.Month -11, 1)

Then I'm curious on say Feb, if I create a stop date of say
Dim sM2 = New DateTime(Now.Year, Now.Month - 1, 31) since Feb has 28 or 29 days.
I suspect it will crash, haven't tried it yet.

Basically, these dates will be injected into a Linq group operation.

Well I guess I could write a function to calculate this, and pass months back and return a date with time of midnight.
If it ain't broke don't fix it
Discover my world at jkirkerx.com

AnswerRe: How to create new DateTime of months, going back 12 months [it works] Pin
jkirkerx17-Feb-20 8:52
professionaljkirkerx17-Feb-20 8:52 
AnswerRe: How to create new DateTime of months, going back 12 months Pin
Richard Deeming18-Feb-20 2:20
mveRichard Deeming18-Feb-20 2:20 
GeneralRe: How to create new DateTime of months, going back 12 months Pin
jkirkerx18-Feb-20 7:18
professionaljkirkerx18-Feb-20 7:18 
GeneralRe: How to create new DateTime of months, going back 12 months Pin
Richard Deeming18-Feb-20 7:42
mveRichard Deeming18-Feb-20 7:42 
QuestionHOW TO CREATE RDLC REPORT AND CALL IN VS 2013 Pin
Member 146289475-Feb-20 0:39
Member 146289475-Feb-20 0:39 
AnswerRe: HOW TO CREATE RDLC REPORT AND CALL IN VS 2013 Pin
Richard MacCutchan5-Feb-20 2:11
mveRichard MacCutchan5-Feb-20 2:11 
QuestionMS Acces Form (VBA) - Listview to Textbox etc Pin
Jayvee Pacanza1-Feb-20 17:35
Jayvee Pacanza1-Feb-20 17:35 
QuestionRe: MS Acces Form (VBA) - Listview to Textbox etc Pin
Richard MacCutchan1-Feb-20 21:32
mveRichard MacCutchan1-Feb-20 21:32 
AnswerRe: MS Acces Form (VBA) - Listview to Textbox etc Pin
Jayvee Pacanza2-Feb-20 4:40
Jayvee Pacanza2-Feb-20 4:40 
GeneralRe: MS Acces Form (VBA) - Listview to Textbox etc Pin
Mycroft Holmes4-Feb-20 11:50
professionalMycroft Holmes4-Feb-20 11:50 
QuestionExcel Import Pin
RajaMohammed.A31-Jan-20 22:45
RajaMohammed.A31-Jan-20 22:45 
AnswerRe: Excel Import Pin
JR2125-Feb-20 19:51
JR2125-Feb-20 19:51 
QuestionExcel VBA seems to read an old value from a cell Pin
idkd30-Jan-20 18:02
idkd30-Jan-20 18:02 
QuestionRe: Excel VBA seems to read an old value from a cell Pin
Eddy Vluggen30-Jan-20 22:01
professionalEddy Vluggen30-Jan-20 22:01 
AnswerRe: Excel VBA seems to read an old value from a cell Pin
Mycroft Holmes31-Jan-20 10:41
professionalMycroft Holmes31-Jan-20 10:41 
AnswerRe: Excel VBA seems to read an old value from a cell Pin
ZurdoDev31-Jan-20 10:49
professionalZurdoDev31-Jan-20 10:49 
Questioncant get Ascii art to display after the RLE file Pin
Member 1472117930-Jan-20 0:57
Member 1472117930-Jan-20 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.