cancel
Showing results for 
Search instead for 
Did you mean: 

DATE problem

Former Member
0 Kudos

hi experts

what i want

i have one date filed in form . first time i insert date 12/03/08 . when second time this (12/03/08) date insert date some message will show

i want to show mesage SBO_Application.MessageBox("20")

if it is True

but i got

SBO_Application.MessageBox("21")

plz help me ....

my code

Private Function test_con(ByVal tdt1 As String) As Boolean

Dim RS As SAPbobsCOM.Recordset

Dim Bob As SAPbobsCOM.SBObob

' Dim z As String

Try

Bob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)

RS = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

RS.DoQuery("SELECT convert(varchar(12),U_todt,103) FROM [@suvr] WHERE U_todt ='" & tdt1 & "' ")

RS.MoveFirst()

Do While Not RS.EoF

tdt = RS.Fields.Item("U_todt").Value

Return True

Loop

Catch ex As Exception

MessageBox.Show(ex.Message)

Return False

End Try

End Function

If (pVal.ItemUID = "todt") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS) And pVal.BeforeAction = False Then

Dim todt1 As String

todt1 = oForm.Items.Item("todt").Specific.value

Dim test As String

test = test_con(todt1)

If test = True Then

SBO_Application.MessageBox("20")

Else

SBO_Application.MessageBox("21")

End If

end if

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Im not usre if I understand it correctly. Try to change it as

Private Function test_con(ByVal tdt1 As String) As Boolean

Dim RS As SAPbobsCOM.Recordset

Dim Bob As SAPbobsCOM.SBObob

' Dim z As String

Try

Bob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)

RS = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

RS.DoQuery("SELECT convert(varchar(12),U_todt,103) FROM @suvr WHERE U_todt ='" & tdt1 & "' ")

RS.MoveFirst()

dim x as integer

x = 0

Do While Not RS.EoF

'tdt = RS.Fields.Item("U_todt").Value

x = x + 1

'Return True

Loop

if x > 1 then return True

Catch ex As Exception

MessageBox.Show(ex.Message)

Return False

End Try

End Function

or the problem is in line

tdt = RS.Fields.Item("U_todt").Value

you are accesing field todt, but this field isnt in recordset, you must change result with AS

RS.DoQuery("SELECT convert(varchar(12),U_todt,103) as X FROM @suvr WHERE U_todt ='" & tdt1 & "' ")

and

tdt = RS.Fields.Item("X").Value

Edited by: Petr Verner on Sep 5, 2008 8:24 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

thanks for reply

problem solved

Edited by: Animesh Sinha on Sep 8, 2008 10:51 AM

Former Member
0 Kudos

ODocDate.String = Date.Today.ToString("dd/MM/yy")

Former Member
0 Kudos

hi

try this one here iam using start time end time

Dim test As String

Dim st, st1, st2, fina1, st3, cont, fina11, fina3 As String

Dim tet, tet1, tet2, tet3, tota, tota1, fina, fina75 As Double

Dim index As Integer

Dim index1 As Integer

Dim index11 As Integer

omatrix = RFrm.Items.Item("").Specific

GCols = omat1.Columns

st = dou - 1200

index = st.Length()

tet = st.Substring(st.Length() - 2, 2)

tet1 = st.Substring(0, st.Length() - 2)

tota = (tet1 * 60) + tet

st2 = dou1 - 1200

index1 = st2.Length()

tet2 = st2.Substring(st2.Length() - 2, 2)

tet3 = st2.Substring(0, st2.Length() - 2)

tota1 = (tet3 * 60) + tet2

fina = tota1 - tota

fina1 = fina / 60

index11 = fina1.Length()

fina75 = fina1.Substring(fina1.Length() - 2, 2)

fina11 = fina75 * 60 / 100

fina3 = fina1.Substring(0, fina1.Length() - 2)

cont = fina3 + fina11

Regards.

Billa 2007