Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 14th, 2003, 12:16 PM
hbcontract hbcontract is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 59 hbcontract User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 36 sec
Reputation Power: 5
System auto setting?

Hi all, I have a form which can let user select certain date for auto update. I am wondering how can I make the system auto insert the query to database when the date is here?

for example: If the user selected first day of every month to withdraw $100 from the bank_account table. How to set it run automatically? My code as follows, it works after I click on the submit setting button. But how can I make sure it will run automatically without visiting the form?
===================================

....

If cmbAMonth.Text = "Monthly" Then

response = MsgBox("Deposit " & txtAutoAmount.Text & " To " & cmbFromBank.Text & " on " & cmbADay.Text & " " & cmbAMonth.Text & " For " & txtAutoCName.Text & ".")

Dim autoUpdate As String
Dim rs2 As New ADODB.Recordset
Dim getBankN() As String
Dim bankName As String

bankName = cmbFromBank.Text
getBankN = Split(bankName, "- ")

Dim autodate As String
Dim monthM As Integer
Dim yearY As Integer

monthM = month(Date)
yearY = Year(Date)

autodate = monthM & "/" & cmbADay.Text & "/" & yearY

MsgBox autodate

If autodate = Date Then

autoUpdate = "INSERT INTO REPORT VALUES( #" & ctm & "#, '" & getBankN(0) & "', '" & getBankN(1) & "', '" & txtAutoAmount.Text & "', 'Deposit','" & txtAutoCName.Text & "', 'Auto Setting')"
Set rs2 = cn.Execute(autoUpdate)

MsgBox "Done"

Else
MsgBox "Not inserted!"
End If

End If

.....

Reply With Quote
  #2  
Old October 14th, 2003, 01:56 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
I'm not sure how you would do such a thing in Office. I know you can schedule batch jobs in DOS, and, of course, in SQL Server, there are DTS Packages, but short of something like the Linux Chron utility... I have no idea. That would have to be written into the package as a windows service or something.
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > System auto setting?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway