...

View Full Version : Transfer vbscript from Access to ASP



parallon
03-23-2006, 03:26 PM
Hello all,

We have a current application written in the backend of Access using vbscript, and we are trying to bring this application to the web. There is a function/subroutine in the program which I need, and I was wondering what sort of alterations to the code would be needed to include this in my ASP pages? I tried the copy and paste, with no prevail. I am under the impression that vbscript can be used in ASP.

Code in MS Access:

Private Sub ThisWeek_Click()
Ago = Weekday(Now, 1)

If Ago = 1 Then
StartDate = Date() - 3 - Ago
'Date = Now - 3 - Ago
EndDate = StartDate + 6
Else
If Ago = 2 Then
StartDate = Now - 3 - Ago
'Date = Now - 3 - Ago
EndDate = StartDate + 6
Else
If Ago = 3 Then
StartDate = Now - 3 - Ago
'Date = Now - 3 - Ago
EndDate = StartDate + 6
Else
StartDate = Now + 4 - Ago
'Date = Now + 4 - Ago
EndDate = StartDate + 6
End If
End If
End If

Me![StartDate].Value = Month([StartDate]) & "/" & Day([StartDate]) & "/" & Year([StartDate])
Me![EndDate].Value = Month([EndDate]) & "/" & Day(Me![EndDate]) & "/" & Year(Me![EndDate])
Me![EmpName].SetFocus
End Sub

There are a couple other routines that I need also, but if I could just get an idea of the difference in the format, I think I could go from there.

Thanks in advance,

Parallon

miranda
03-25-2006, 05:58 PM
Yes you can use VBScript in ASP in fact it is the default language if there is no language specified in the @ statement.

However, you have to keep in mind that in classic asp there is no server side click event that can be used. Many of the things that are available for use in VBScript that is done on the client side are not available for use in ASP pages where the operation is done on the server. like the click event, MsgBox etc...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum