Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
VBscript from MS Access to ASP???
Old 03-23-2006, 11:36 AM VBscript from MS Access to ASP???
Average Talker

Posts: 19
Trades: 0
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:
Code:
  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
parallon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-23-2006, 12:33 PM Re: VBscript from MS Access to ASP???
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Not all VBScript can be turned into ASP, although ASP is based off of VBScript (confusing, eh?)

The only things you would need to change are your Me! sections. There really isn't an equivalent ASP form code as such for them (although you could use javascript for some of it e.g. the focus.)

For the form fields, I'd do something like:
Code:
Start_Date = Month (RS ("Start_Date")) & "/" & Day (RS ("Start_Date")) & "/" & Year (RS ("Start_Date"))
Response.write "<input type=""Start_Date"" type=""text"" size=""8"" maxlength="12" value=""" & Start_Date & """ />"
This just reminded me...you'll need to explicitly create and destroy connection and recordset objects with ASP. By default, you don't get those (since ASP isn't just about MS Access). Hence the reference to RS ("Start_Date").

For more information, http://www.webwizguide.info/asp/tuto...a_database.asp has a good starter tutorial. It's not the best (you'll learn how to optimize it with time and error) but it's a good start.

The rest of that code should work fine.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 03-23-2006, 01:26 PM Re: VBscript from MS Access to ASP???
Average Talker

Posts: 19
Trades: 0
Thank you very much for your reply. I will give it a try!

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to VBscript from MS Access to ASP???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.84422 seconds with 12 queries