If dr2.Item("DischargeDateTime").ToString = "" And dr2.Item("AdmitDateTime").ToString <> "" Then
'Do nothing! patient is active in EPR'
ElseIf dr2.Item("DischargeDateTime").ToString = "" And dr2.Item("AdmitDateTime").ToString = "" Then
'Send an A03 to discharge patient'
EPRAdmitDate = dr2.Item("AdmitDateTime").ToString
EPRLocation = dr2.Item("OutpatientLocationID").ToString
EPRRoomID = dr2.Item("RoomID").ToString
EPRBedID = dr2.Item("Bed").ToString
EPRName = dr2.Item("Name").ToString
EPRAcctNum = dr2.Item("AccountNumber").ToString
EPRUnitNum = dr2.Item("UnitNumber").ToString
[b] EPRDateDish = Date2[/b]
sMessage = ""
sMessage = "MSH|^~\&||QMIDEMO|ADT^A03|14624160|P|2.10|" & vbCr
sMessage = sMessage & "EVN|A03|" & Format(Now(), "yyyyMMddHHmm") & vbCr
sMessage = sMessage & "PID|||" & EPRUnitNum & "^^/>||" & EPRName & "|||||||||||||" & EPRAcctNum & "||" & vbCr
sMessage = sMessage & "PV1||I|" & EPRLocation & "^" & EPRRoomID & "^" & EPRBedID & "|||" & EPRLocation & "^" & EPRRoomID & "^" & EPRBedID & "||^|^||||||||^, ||||||||||||||||||||||713||PRE|||" & EPRAdmitDate & "||" & [b]FormatDateTime(EPRDateDish, "yyyyMMddHHmm") [/b]& "||"
sMessage = Chr(11) + sMessage + Chr(28) + Chr(13)
oWrite = File.AppendText(sPath)
oWrite.WriteLine(sMessage)
oWrite.Flush()
oWrite.Close()
FormatDateTime(, "yyyyMMddHHmm IN VB6trying to reformat my data from what it pulls to yyyyMM and etc.
Page 1 of 1
3 Replies - 13286 Views - Last Post: 09 June 2009 - 05:11 AM
#1
FormatDateTime(, "yyyyMMddHHmm IN VB6
Posted 04 June 2009 - 01:44 PM
I need help trying to get my Format date to spit out right , i get an error that its invalid, I want my 'FormatDateTime(EPRDateDish, "yyyyMMddHHmm' to spit out the EPRDateDish string in the date that it pulls from my database, but all i tend to get is the format. Any ideas
Replies To: FormatDateTime(, "yyyyMMddHHmm IN VB6
#2
Re: FormatDateTime(, "yyyyMMddHHmm IN VB6
Posted 04 June 2009 - 05:00 PM
When you are building the sMessage string, you are using the expression .
The problem might be when you assign the value into EPRDateDish, the type isn't shown in your code example. If it is a string, it won't work. Date2 and EPRDateDish should both be DateTime types. FormatDateTime expects a DateTime type.
You could use CDate(EPRDateDish) inside the formatdatetime function, but that might be error prone if the string isn't formatted properly.
Quote
FormatDateTime(EPRDateDish, "yyyyMMddHHmm")
The problem might be when you assign the value into EPRDateDish, the type isn't shown in your code example. If it is a string, it won't work. Date2 and EPRDateDish should both be DateTime types. FormatDateTime expects a DateTime type.
You could use CDate(EPRDateDish) inside the formatdatetime function, but that might be error prone if the string isn't formatted properly.
#3
Re: FormatDateTime(, "yyyyMMddHHmm IN VB6
Posted 05 June 2009 - 08:11 AM
When you type in FormatDateTime it gives you options to choose - ie Short date long date etc
Try just a plain format -
[code]
MsgBox Format(PRDateDish,"yy-mm-dd-hh-mm", vbUseSystemDayOfWeek)
]/code]
Try just a plain format -
[code]
MsgBox Format(PRDateDish,"yy-mm-dd-hh-mm", vbUseSystemDayOfWeek)
]/code]
#4
Re: FormatDateTime(, "yyyyMMddHHmm IN VB6
Posted 09 June 2009 - 05:11 AM
Thanks guys i used Format(EPRDishDate, "yyyyMMddHHmm") I feel like an idiot though because the whole time i had the write syntax but i was trying to pull data from the wrong if statement. So basically the reason it wasn't working was because i was pulling null data lol. thanks for the help again
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|