Click here to Skip to main content
15,888,401 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Suddenly the Form.Shown event doesn't fire anymore Pin
Richard Deeming18-Mar-15 2:49
mveRichard Deeming18-Mar-15 2:49 
GeneralRe: Suddenly the Form.Shown event doesn't fire anymore Pin
dilkonika18-Mar-15 13:13
dilkonika18-Mar-15 13:13 
GeneralRe: Suddenly the Form.Shown event doesn't fire anymore Pin
Richard Deeming19-Mar-15 3:40
mveRichard Deeming19-Mar-15 3:40 
QuestionASP ProcessRequest: (91) Object variable or With block variable not set Pin
murali_yaragalla12-Mar-15 23:24
murali_yaragalla12-Mar-15 23:24 
AnswerRe: ASP ProcessRequest: (91) Object variable or With block variable not set Pin
Richard MacCutchan12-Mar-15 23:55
mveRichard MacCutchan12-Mar-15 23:55 
QuestionRC interface with visual basic 6.0 Pin
Member 1151731011-Mar-15 10:27
Member 1151731011-Mar-15 10:27 
AnswerRe: RC interface with visual basic 6.0 Pin
ZurdoDev11-Mar-15 10:48
professionalZurdoDev11-Mar-15 10:48 
QuestionVBA Runtime Error 1004 “Application-defined or Object-defined error” Pin
ravi_bmsce10-Mar-15 19:55
ravi_bmsce10-Mar-15 19:55 
I have code VBA code written in MS Access 2010 (.mbd file) to write data into an Excel file (.xls file). Below is the code to write data into that excel file. When you run this code, it always throws Error#1004 "Application-defined or Object-defined error". When you debug the code (F8) or run it (F5), it runs absolutely fine with out any issues. I am still not able to figure it out on what exactly the issue is. This code works fine when executed in MS Access 2007.

Below is thr code that's getting executed and when it fails, the focus is set on the 3rd last line of the code marked in double astriek mark.

Sub PopulateReport(appExcel As Object, testcam)

Dim Site As String, intRec As Integer, i As Integer, cnt As Integer, intRecSet As Integer, cntr As Integer
Dim F1 As String, F2 As String, F3 As String, F4 As String, F5 As String, F6 As String, F7 As String
Dim F8 As String, F9 As String, F10 As String, F11 As String, F12 As String, F13 As String, CAMDate As Date
Close
i = 0
cnt = 0
cntr = 0
Set cnn = CurrentProject.Connection

rec.Open "SELECT * FROM Site", cnn, adOpenStatic, adLockPessimistic
rec.MoveLast
rec.MoveFirst
intRec = rec.RecordCount
Do Until cnt = intRec
rec.MoveLast
rec.MoveFirst
    rec.Move cnt
    Site = rec(4)
    Select Case Site
        Case "Fort Worth"
            cntr = 0
            recset.Open "SELECT * FROM Employee", cnn, adOpenStatic, adLockPessimistic
            recset.MoveLast
            recset.MoveFirst
            intRecSet = recset.RecordCount
            appExcel.Application.Goto Reference:="START_FW_CL"
            Do Until cntr = intRecSet - 1
                appExcel.Selection.EntireRow.Copy
                appExcel.Selection.EntireRow.Insert
                cntr = cntr + 1
            Loop
            appExcel.Application.CutCopyMode = False
            appExcel.Application.Goto Reference:="START_FW2_CL"
            go = appExcel.Application.Range("START_FW2_CL")
            cntr = 1
             With appExcel.Worksheets("Accts. > Clearing").[START_FW2_CL]
                Do Until recset.EOF
                    **.Offset(cntr, 0) = recset(0)**
                    .Offset(cntr, 1) = recset(1)
                    .Offset(cntr, 2) = recset(2)
End Sub

SuggestionRe: VBA Runtime Error 1004 “Application-defined or Object-defined error” Pin
ZurdoDev11-Mar-15 10:50
professionalZurdoDev11-Mar-15 10:50 
GeneralRe: VBA Runtime Error 1004 “Application-defined or Object-defined error” Pin
ravi_bmsce13-Mar-15 5:01
ravi_bmsce13-Mar-15 5:01 
QuestionWindows CE using Visual Studio 2013 Pin
Member 289206910-Mar-15 5:11
Member 289206910-Mar-15 5:11 
QuestionUNMATCHED DATAS Pin
tuticorinmano8-Mar-15 19:08
tuticorinmano8-Mar-15 19:08 
AnswerRe: UNMATCHED DATAS Pin
Wendelius8-Mar-15 19:18
mentorWendelius8-Mar-15 19:18 
QuestionGet Image from embedded resource Pin
gwittlock5-Mar-15 1:08
gwittlock5-Mar-15 1:08 
AnswerRe: Get Image from embedded resource Pin
iProgramIt8-Mar-15 15:04
professionaliProgramIt8-Mar-15 15:04 
GeneralRe: Get Image from embedded resource Pin
gwittlock9-Mar-15 0:16
gwittlock9-Mar-15 0:16 
Questioni00 Spell checker Pin
Member 114920223-Mar-15 0:41
Member 114920223-Mar-15 0:41 
SuggestionRe: i00 Spell checker Pin
Richard Deeming3-Mar-15 5:21
mveRichard Deeming3-Mar-15 5:21 
GeneralRe: i00 Spell checker Pin
Member 114920223-Mar-15 23:26
Member 114920223-Mar-15 23:26 
Questionhow can i delete a listview item fetched from a database??? Pin
Hakeem Celis Samuddin25-Feb-15 4:01
Hakeem Celis Samuddin25-Feb-15 4:01 
SuggestionRe: how can i delete a listview item fetched from a database??? Pin
Richard MacCutchan25-Feb-15 4:27
mveRichard MacCutchan25-Feb-15 4:27 
AnswerRe: how can i delete a listview item fetched from a database??? Pin
ZurdoDev3-Mar-15 6:08
professionalZurdoDev3-Mar-15 6:08 
AnswerRe: how can i delete a listview item fetched from a database??? Pin
KreativeKai9-Mar-15 7:40
professionalKreativeKai9-Mar-15 7:40 
AnswerRe: how can i delete a listview item fetched from a database??? Pin
MBV-Media16-Mar-15 2:11
MBV-Media16-Mar-15 2:11 
QuestionService application Pin
Satyajit Rath@2974925-Feb-15 0:15
Satyajit Rath@2974925-Feb-15 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.