G
Guest
Code:
On Error GoTo Err_ErrHandler
Dim strCartName As String
Dim updateQry As String
Dim NumToOrder As Integer
Dim varDate As Date
Dim tmpDate As String
Dim strOnOrder As String
Dim x As Byte
varDate = Me.txtDate.Value
tmpDate = FormatDateTime(varDate, vbShortDate)
If Me.txtNumToOrder.Value > 0 Then
NumToOrder = Me.txtNumToOrder.Value
Else
x = Warning(strTitNull, "You Have Not Entered the Number of " & _
Me.cboCartName.Value & " to order!")
Exit Sub
End If
If Me.txtPPU.Value = 0 Then
x = Warning(strTitNull, "You have left the Price Per Unit Field
Blank!!")
Exit Sub
End If
'prevents the user leaving the cartridge field blank
If IsNull(Me.cboCartName.Value) = False Then
strCartName = Me.cboCartName.Value
Else
x = Warning(strTitNull, "You have left the Cartridge Field Blank!!")
Exit Sub
End If
'--------------------------------------------------------------
'Creates a current order
updateQry = "UPDATE tblOrderCurr SET " & _
"OnOrder=OnOrder+" & NumToOrder & _
", PricePerUnit=" & Me.txtPPU.Value & _
", OrderDate=#" & varDate & _
"# WHERE " & _
"((tblOrderCurr.CartridgeName)=" & Chr$(39) & strCartName & Chr$(39)
& ");"
DoCmd.RunSQL (updateQry)
updateQry = "UPDATE tblOrderCurr SET " & _
"TotalCost=(OnOrder*PricePerUnit) " & _
" WHERE " & _
"((tblOrderCurr.CartridgeName)=" & Chr$(39) & strCartName & Chr$(39)
& ");"
DoCmd.RunSQL (updateQry)
'Sets the chk box onorder in tblCartridges
strOnOrder = "UPDATE tblCartridges SET " & _
"OnOrder=-1 " & _
"WHERE " & _
"((tblCartridges.CartridgeName)=" & Chr$(39) & strCartName &
Chr$(39) & ");"
DoCmd.RunSQL (strOnOrder)
Me.Refresh
Exit_ErrHandler:
Exit Sub
Err_ErrHandler:
MsgBox "Error: " & Err.Number & ". " & Err.Description
Resume Exit_ErrHandler
End Sub
Here is an example of the string updateqry (its first instance)
"UPDATE tblOrderCurr SET OnOrder=OnOrder+30, PricePerUnit=400,
OrderDate=#08/12/2005# WHERE ((tblOrderCurr.CartridgeName)='Minolta
1710471-001');"
But when i look in my database table the above is dispolayed as:
CartridgeName
Minolta 1710471-001
OnOrder
30
PricePerUnit
£400.00
TotalCost
£12000.00
OrderDate
12/08/2005
Late
0
------------------------
Why is it reversing my date to put the month first.
My computers regional settings are UK and so is my timezone
And as you can see above when the date is in the insert statment it is in
the correct format so why is it being changed as soon as it is added to the
database record?
The field is set to short date and is displayed as the correct format in the
format selection box...