J
John Desselle
MS Access 2000 database created on W2K.
Upgraded box to MS Access 2003 and WinXP
User clicks button and is able to select file from network. The path of
this file is loaded into my database form. There are a couple of drop down
boxes to choose stuff and blanks for username and password.
Another button should populate a subform in datasheet view with all this
information and create a html link to file so that a FTP process can upload
the info into a web application with links to documents chosen.
I'm getting "438 - Object doesn't support this property or method" when the
'Add' button is clicked to populate the datasheet.
I've taken the 2000 database and converted into 2003, checked references,
neither helped out. There is error handling written in, but I can't even
make it fire off by leaving out some of the required info.
I'm wondering if someone could peek at this code for the 'Add' Button and
tell me if they find anything.
Thanks
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
If Me.cmbOffice = "" Or Me.txtFull_filename = "" Then
MsgBox "Please select file before save"
Exit Sub
End If
If Me.ftpuser = "" Or Me.ftppass = "" Then
MsgBox "Please enter Username and Password"
Exit Sub
End If
filefullname = Me.txtFull_filename
ftpuser = Me.ftpuser
ftppass = Me.ftppass
Dim stSQL As String
position = 1
short_filename = Me.txtFull_filename
Do While position > 0
position = InStr(1, short_filename, "\", vbTextCompare)
If position > 0 Then short_filename = Right(short_filename,
Len(short_filename) - position)
Loop
If Me.Draft = "" Or Me.Bill_Number > "" Or Me.Bill_Type > "" Then
FileName = Me.Bill_Type & Me.Bill_Number & Me.cmbOffice & Me.cmbType &
Me.cmbVersion & Year(Date) & Month(Date) & Day(Date) & Right(filefullname, 4)
Else
FileName = "Draft" & Me.Draft & Me.cmbOffice & Me.cmbType &
Me.cmbVersion & Year(Date) & Month(Date) & Day(Date) & Right(filefullname, 4)
End If
''''''''''''''do the ftp'''''''''''''
Me.ctlFTP.UserName = ftpuser
Me.ctlFTP.Password = ftppass
Me.ctlFTP.LocalFile = filefullname
Me.ctlFTP.RemoteFile = FileName
Me.ctlFTP.Binary = True
Me.ctlFTP.RemoteAddress = "intra"
' On Error Resume Next
Me.ctlFTP.Connect
Me.ctlFTP.RemoteDirectory = "/reports"
Me.ctlFTP.PutFile
Me.ctlFTP.Disconnect
' If Err <> 0 Then
' MsgBox "Unable to put file. Error code : " & Format$(Err.Number)
' End If
strShortDate = Format(Now(), "SHORT DATE")
Set con = Application.CurrentProject.Connection
stSQL = "insert into Agency_Files ( Agency_Code,
Legislation_id,Full_Filename,url_link, file_version, imp_type, upload_date )"
stSQL = stSQL & " values('" & Me.cmbOffice & "', " & Me.id & ",'" &
filefullname & "','http://intra.xxxxxx/xxxxxxxx/xxxxxxx//" & FileName & "',
'" & Me.cmbVersion & "', '" & Me.cmbType & "', '" & strShortDate & "')"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSQL, con, 1 ' 1 = adOpenKeyset
Set rs = Nothing
Set con = Nothing
Me.txtFull_filename = ""
Me.cmbOffice = ""
Me.cmbVersion = ""
Me.cmbType = ""
Me.ftpuser = ""
Me.ftppass = ""
Me.Agency_Files_subform.Requery
exit_cmdadd_click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Number & "-" & Err.Description
Resume exit_cmdadd_click
End Sub
Upgraded box to MS Access 2003 and WinXP
User clicks button and is able to select file from network. The path of
this file is loaded into my database form. There are a couple of drop down
boxes to choose stuff and blanks for username and password.
Another button should populate a subform in datasheet view with all this
information and create a html link to file so that a FTP process can upload
the info into a web application with links to documents chosen.
I'm getting "438 - Object doesn't support this property or method" when the
'Add' button is clicked to populate the datasheet.
I've taken the 2000 database and converted into 2003, checked references,
neither helped out. There is error handling written in, but I can't even
make it fire off by leaving out some of the required info.
I'm wondering if someone could peek at this code for the 'Add' Button and
tell me if they find anything.
Thanks
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
If Me.cmbOffice = "" Or Me.txtFull_filename = "" Then
MsgBox "Please select file before save"
Exit Sub
End If
If Me.ftpuser = "" Or Me.ftppass = "" Then
MsgBox "Please enter Username and Password"
Exit Sub
End If
filefullname = Me.txtFull_filename
ftpuser = Me.ftpuser
ftppass = Me.ftppass
Dim stSQL As String
position = 1
short_filename = Me.txtFull_filename
Do While position > 0
position = InStr(1, short_filename, "\", vbTextCompare)
If position > 0 Then short_filename = Right(short_filename,
Len(short_filename) - position)
Loop
If Me.Draft = "" Or Me.Bill_Number > "" Or Me.Bill_Type > "" Then
FileName = Me.Bill_Type & Me.Bill_Number & Me.cmbOffice & Me.cmbType &
Me.cmbVersion & Year(Date) & Month(Date) & Day(Date) & Right(filefullname, 4)
Else
FileName = "Draft" & Me.Draft & Me.cmbOffice & Me.cmbType &
Me.cmbVersion & Year(Date) & Month(Date) & Day(Date) & Right(filefullname, 4)
End If
''''''''''''''do the ftp'''''''''''''
Me.ctlFTP.UserName = ftpuser
Me.ctlFTP.Password = ftppass
Me.ctlFTP.LocalFile = filefullname
Me.ctlFTP.RemoteFile = FileName
Me.ctlFTP.Binary = True
Me.ctlFTP.RemoteAddress = "intra"
' On Error Resume Next
Me.ctlFTP.Connect
Me.ctlFTP.RemoteDirectory = "/reports"
Me.ctlFTP.PutFile
Me.ctlFTP.Disconnect
' If Err <> 0 Then
' MsgBox "Unable to put file. Error code : " & Format$(Err.Number)
' End If
strShortDate = Format(Now(), "SHORT DATE")
Set con = Application.CurrentProject.Connection
stSQL = "insert into Agency_Files ( Agency_Code,
Legislation_id,Full_Filename,url_link, file_version, imp_type, upload_date )"
stSQL = stSQL & " values('" & Me.cmbOffice & "', " & Me.id & ",'" &
filefullname & "','http://intra.xxxxxx/xxxxxxxx/xxxxxxx//" & FileName & "',
'" & Me.cmbVersion & "', '" & Me.cmbType & "', '" & strShortDate & "')"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSQL, con, 1 ' 1 = adOpenKeyset
Set rs = Nothing
Set con = Nothing
Me.txtFull_filename = ""
Me.cmbOffice = ""
Me.cmbVersion = ""
Me.cmbType = ""
Me.ftpuser = ""
Me.ftppass = ""
Me.Agency_Files_subform.Requery
exit_cmdadd_click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Number & "-" & Err.Description
Resume exit_cmdadd_click
End Sub