Help for VBA module code in MS Access 2003

prdinesh81

New member
Local time
Today, 16:49
Joined
Jun 30, 2008
Messages
3
Hi,

How to assign Date variable into existing recordset variable and the same date variable should be assigned to [START_DATE] label in forms, it should update date in forms while we add new data . How to resolve using VBA code in MS Access 2003.
Please see the below VBA code for your information.

Private Sub Combo35_AfterUpdate()
' Find the record that matches the control.

Dim RS As Object
Dim sMyVar As Date

Set RS = Me.Recordset.Clone
'MsgBox ("RecordCount: " & RS.RecordCount)

RS.FindFirst "[URL_ID] = '" & Me![Combo35] & "'"

sMyVar = RS![START_DATE]
MsgBox (sMyVar)
'RS.FindFirst "[START_DATE] = Null"
'Set RS![START_DATE] = Now()

'MsgBox ("Before Now " & sMyVar)
' sMyVar = Date
'MsgBox ("After Now " & sMyVar)
'If sMyVar Is Null Then RS.[START_DATE] = Now()
'If IsNull(START_DATE) Then MsgBox (" Start date is null")

If Not RS.EOF Then Me.Bookmark = RS.Bookmark

End Sub

Please help me ASAP
 
Let me ask this - what is happening and what isn't happening? I'm not sure with all the commented out code what you are expecting.
 
Hi,
Thanks for your response
But I could not add Now() as the default value for the control.
Please suggest me and give one example
 
prdinesh81:

Adding Now() as the default of the control entails going to the property dialog, finding the property Default Value and putting

=Now()

including the equal sign
 
But this problem is still persisting so please give me another example
Thanks
 

Users who are viewing this thread

Back
Top Bottom