Periksa Refference (VB Editor > Tools > Refference)




Microsoft DAO 3.x sudah harus ikut terpilih.


aksan kurdin




On 5/11/2010 4:03 PM, Ria wrote:
 
Thanks Pak..
masih sama error messagenya.


From: Aksan Kurdin <aksan.kurdin@gmail.com>
To: belajar-access@yahoogroups.com
Sent: Tue, May 11, 2010 3:33:15 PM
Subject: Re: [belajar-access] Conversi Access 97 ke 2007

 

On 5/11/2010 3:10 PM, Nuria wrote:

 
selamat siang para master, saya sedang mengconvert aplikasi access dari Access 97 ke access 2007.
aplikasi ini untuk mngupdate exchange rate setiap bulannya
setelah saya convert ke access 2007,  tombol save saya mengalami error ketika saya mengkliknya (error message: application- object define error)
mohon bantuannya
terimakasih banyak ..
 
berikut codenya untuk button save tersebut:
Private Sub cmdSave_Click( )
   Dim DB           As DAO.Database
   Dim objExcel     As Object
   Dim intRow       As Integer
   Dim intRows      As Integer
   Dim strCellName  As String
   Dim strCurr      As String
   Dim intMonth     As Integer
   Dim intYear      As Integer
   Dim strQuery     As String
   Dim NewValue     As Double
   Dim strExcelFile As String
  
On Error GoTo Err_cmdSave_ Click
  
   DoCmd.Hourglass True
   Set DB = CurrentDb
   
   
     'strExcelFile = "I:\test\UpdateCurr .xls"
   Set objExcel = GetObject(strExcelF ile)
 
   intRows = objExcel.ActiveShee t.Range(" NumLines" ).Value
   intMonth = objExcel.ActiveShee t.Range(" Month").Value
   intYear = objExcel.ActiveShee t.Range(" Year").Value
  
   For intRow = 1 To intRows
       strCurr = objExcel.ActiveShee t.Range(" CUR" & Format(intRow) ).Value
       NewValue = objExcel.ActiveShee t.Range(" USD" & Format(intRow) ).Value
       strQuery = "UPDATE CurrExchRate SET USD = " & Format(NewValue) & " , Year = " & _
              Format(intYear) & " WHERE Month = " & Format(intMonth) & " AND Code = '" & strCurr & "';"
       DB.Execute (strQuery)
   Next
  
   DoCmd.Hourglass False
   MsgBox "Currency Exchange Rates have been updated !", vbInformation
  
Exit_cmdSave_ Click:
    Set objExcel = Nothing
    Set DB = Nothing
    Exit Sub
  
Err_cmdSave_ Click:
    DoCmd.Hourglass False
    MsgBox Err.Description, vbExclamation
    Resume Exit_cmdSave_ Click
End Sub




Kirim email ke