Egg 'n' Bacon
Registered User.
- Local time
- Today, 16:56
- Joined
- Oct 19, 2006
- Messages
- 14
I'm trying to change a standard date value into the date format used by our AS400 system (this is year - 1900 & mm & dd e.g. 1st Jan this year = 1060101). I'm using 'Datepart' but I'm running into a couple of problems;
Datepart doesn't give leading zeros, that I need & mid seems to do the same
Concatenating the results sometimes gives overflow.
Here's the code I'm trying to get to work;
Dim intEIStest As Integer
Dim sngEISyr As Single
Dim sngEISmnth As Single
Dim sngEISday As Single
sngEISyr = (DatePart("yyyy", txtDateFrom) - 1900)
sngEISmnth = DatePart("m", txtDateFrom)
sngEISday = DatePart("d", txtDateFrom)
intEIStest = sngEISyr & sngEISmnth & sngEISday
txtTest.Value = intEIStest
I've only just started using VBA so there's likely to be a lot I won't understand. However, I do want to learn.
Datepart doesn't give leading zeros, that I need & mid seems to do the same
Concatenating the results sometimes gives overflow.
Here's the code I'm trying to get to work;
Dim intEIStest As Integer
Dim sngEISyr As Single
Dim sngEISmnth As Single
Dim sngEISday As Single
sngEISyr = (DatePart("yyyy", txtDateFrom) - 1900)
sngEISmnth = DatePart("m", txtDateFrom)
sngEISday = DatePart("d", txtDateFrom)
intEIStest = sngEISyr & sngEISmnth & sngEISday
txtTest.Value = intEIStest
I've only just started using VBA so there's likely to be a lot I won't understand. However, I do want to learn.