I'm sorry about the delay, I had a very close person problem, and well there was no other thought in my head except that problem....so her is the code, this works, however.....well I would like it to click go and hae this run in a loop untill all the files are fully imported, I know how to do everything except one thing, and that is to trigger getting the link to load without clicking on a button and having the address attached to it. bassicaly i'm lookin for a silver bullet that would run and say go to this link, the webpage opens and you click save, I have the program do everything it needs to do and then go to the next record to download.
Private Sub Command_Button_Click()
If Me![List4] = "" Then
MsgBox "You did not select a Symbol you silly person in your Pink Hairless Monkey Suit!.", vbOKOnly
Else
If Me![Command Button].Caption = "Done" Then
MsgBox "File has already been Imported." & vbNewLine & _
"Please Select another Symbol.", vbOKOnly
Else
Dim stLinkCriteria As String
Dim stLinkCriteriaPart1 As String
Dim stLinkCriteriaPart2 As String
Dim StlinkCriteriaPart3 As String
stLinkCriteriaPart1 = "http://data.moneycentral.msn.com/scripts/chrtsrv.dll?Symbol="
stLinkCriteriaPart2 = DLookup("[Symbol]", "Links", "[Link ID Tag]=" & Me![Link ID Tag])
StlinkCriteriaPart3 = "&FileDownload=&C1=1&C2=&C3=10&C4=3&C5=2&C6=2006&C7=2&C8=2006&C9=2&CE=0&CF=0&D3=0&D4=1&D5=0"
stLinkCriteria = stLinkCriteriaPart1 + stLinkCriteriaPart2 + StlinkCriteriaPart3
If Me![Command Button].Caption = "Download File" Then
Me![Command Button].hyperlinkaddress = stLinkCriteria
Me![Downloaded] = -1
Me![Command Button].Caption = "Import File"
Me.Refresh
Else
If Me![Imported] = 0 Then
Dim RecordAt As Integer
Dim RecordCount As Integer
Dim FilePath As String
FilePath = DLookup("[Path]", "File Path", "[ID Tag]=1")
DoCmd.CopyObject , "TempCopy", acTable, "Temp"
Me![Command Button].hyperlinkaddress = ""
DoCmd.TransferText acImportDelim, , "TempCopy", FilePath & stLinkCriteriaPart2 & ".csv"
DoCmd.OpenForm "Delete TempCopy Blank Records", acNormal, , , , acWindowNormal
Kill FilePath & stLinkCriteriaPart2 & ".csv"
RecordAt = DMin("[F7]", "TempCopy")
RecordCount = DMax("[F7]", "TempCopy")
DoCmd.SetWarnings False
For RecordAt = RecordAt To (RecordAt + 5)
[Forms]![Delete TempCopy Blank Records].SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Next
DoCmd.DeleteObject acTable, stLinkCriteriaPart2 & "_ImportErrors"
DoCmd.SetWarnings True
DoCmd.Close acForm, "Delete TempCopy Blank Records", acSaveYes
For RecordAt = RecordAt To RecordCount
DoCmd.OpenForm "TempCopy to Stock Data", acNormal, , , acFormAdd, acHidden
[Forms]![TempCopy to Stock Data]![Date] = DLookup("[F1]", "TempCopy", "[F7]=" & RecordAt)
[Forms]![TempCopy to Stock Data]![Open] = DLookup("[F2]", "TempCopy", "[F7]=" & RecordAt)
[Forms]![TempCopy to Stock Data]![High] = DLookup("[F3]", "TempCopy", "[F7]=" & RecordAt)
[Forms]![TempCopy to Stock Data]![Low] = DLookup("[F4]", "TempCopy", "[F7]=" & RecordAt)
[Forms]![TempCopy to Stock Data]![Close] = DLookup("[F5]", "TempCopy", "[F7]=" & RecordAt)
[Forms]![TempCopy to Stock Data]![Volume] = DLookup("[F6]", "TempCopy", "[F7]=" & RecordAt)
[Forms]![TempCopy to Stock Data]![Link ID Tag] = Me![Link ID Tag]
DoCmd.Close acForm, "TempCopy to Stock Data", acSaveYes
Next
Me![Imported] = -1
DoCmd.DeleteObject acTable, "TempCopy"
Me![Command Button].Caption = "Done"
DoCmd.Close acForm, "Add Record", acSaveYes
DoCmd.OpenForm "Add Record", acNormal, , , , acWindowNormal
MsgBox "Import Completed.", vbOKOnly, "Complete"
Else
MsgBox "File is already imported, select another.", vbOKOnly
End If
End If
End If
End If
End Sub