Passing Date values from form to module (1 Viewer)

waxdart23

Registered User.
Local time
Today, 23:00
Joined
Nov 20, 2002
Messages
25
I currently use -
Call UpdatePerformanceAdd(StewID.Value)

to pass an integer value to a module for use in the VB code -
Public Sub UpdatePerformanceAdd(lStew_Num As Long)

I know wish to pass two date values from the same form to the same module to use in a query in the module. I'm not sure how to do this, I assume the module part of the code should be-
Public Sub UpdatePerformanceAdd(lStew_Num As Long, StartDate As Date, EndDate As Date)

Is this correct and also how do I pass these date values?
 

waxdart23

Registered User.
Local time
Today, 23:00
Joined
Nov 20, 2002
Messages
25
Whilst waiting for a reply I had a go and used the code below -

Call UpdatePerformanceAdd(StewID.Value, DateValue(SDate))

Public Sub UpdatePerformanceAdd(lStew_Num As Long, StartDate As Date)

This doesnt work, the query in my module which uses the date value as a filter (ie all records where date is greater than) ignores this value and selects ALL records.

If the syntax was incorrect in the module I would have though it would have brought up an error which makes me think that the data is being passed but is formatted incorrectly.
 

waxdart23

Registered User.
Local time
Today, 23:00
Joined
Nov 20, 2002
Messages
25
I have worked out that is because the VB code uses the date in US format. How to re convert it back to UK format.

I tried -
Code:
Dim DateConv As Date
DateConv = Format(Me.SDate, "dd/MM/yy")

But it didnt work.
 

Users who are viewing this thread

Top Bottom