October 22, 2020, 11:08:05 pm
News: IF YOU ARE A MEMBER FROM THE ORIGINAL SITE AND CAN'T LOGIN. POST IN THE FEEDBACK FORUM (AS GUEST) AND AN ADMIN WILL ASSIST YOU TO ACCESS THE SITE!
Pages: [1]   Go Down
Author Topic: Weird Access problem  (Read 1179 times)
Slowhand
Supporters
*

Stars: +0/-0
Offline Offline

Gender: Male
Awards:
Topic Necromancer
Posts: 4668


I code C#!


WWW
« on: May 19, 2003, 08:45:20 am »

I have a strange Access problem.

I use this code to get data from an Excel sheet:

[vbcode]
Set rs = db.OpenRecordset(\"Cijfers\")

While .Range(\"B\" & i).Value [] \"\"

    rs.AddNew

    rs.Fields(\"LeerlingID\").Value = .Range(\"A\" & i).Value
    rs.Fields(\"VakID\").Value = .Range(\"C3\").Value
    rs.Fields(\"Cijfer\").Value = .Range(Chr(intColumn) & i).Value
    Debug.Print \"Cijfer\"
    rs.Update
    Debug.Print \"Update\"
    rs.Close
    Debug.Print \"close\"
     
    i = i + 1

Wend
[/vbcode]

Somehow the proces stops after [Debug.Print \"Cijfer\"].
The debug messages \"Update\" and \"Close\" never appear.

Is there a way to force an update?

Thanks,

CJ
Logged


phunkydude
Newbie
*

Stars: +0/-0
Offline Offline

Posts: 4


WWW
« Reply #1 on: May 19, 2003, 03:53:00 pm »

Hi CJ

I think your lack of error handling is putting you off. Try step through the code to check if it actual does the rs.Update
Logged

Beacon
Monster Poster
*

Stars: +0/-0
Offline Offline

Posts: 1509



WWW
« Reply #2 on: May 20, 2003, 12:19:46 am »

yeah get rid of the debug.print \"Cijfer\" your interupting the update if i\'m correct.
Does it update?
Logged

the future's for discovering the space in which we travel in

Slowhand
Supporters
*

Stars: +0/-0
Offline Offline

Gender: Male
Awards:
Topic Necromancer
Posts: 4668


I code C#!


WWW
« Reply #3 on: May 20, 2003, 06:49:48 am »

NO, it doesn\'t update.

I changed it to this: But still it doesn\'t complete the loop.... Sad

[vbcode]
While .Range(\"B\" & i).Value [] \"\"

    rs.AddNew

    rs.Fields(\"LeerlingID\").Value = .Range(\"A\" & i).Value
    rs.Fields(\"VakID\").Value = .Range(\"C3\").Value
    rs.Fields(\"Cijfer\").Value = .Range(Chr(intColumn) & i).Value
    rs.Update \'dbUpdateRegular, True
   
         
   
i = i + 1
Wend

rs.Close[/vbcode]
Logged


Slowhand
Supporters
*

Stars: +0/-0
Offline Offline

Gender: Male
Awards:
Topic Necromancer
Posts: 4668


I code C#!


WWW
« Reply #4 on: May 20, 2003, 07:15:51 am »

It really hangs on the Update....
Logged


phunkydude
Newbie
*

Stars: +0/-0
Offline Offline

Posts: 4


WWW
« Reply #5 on: May 20, 2003, 10:40:18 am »

That\'s what I though...

For a quick check try this
Code:
on error resume next

rs.update

debug.print err.description



Then tell us what that showed
Logged

Slowhand
Supporters
*

Stars: +0/-0
Offline Offline

Gender: Male
Awards:
Topic Necromancer
Posts: 4668


I code C#!


WWW
« Reply #6 on: May 20, 2003, 10:46:21 am »

OK, I found it. THanks thumb_yello
I forgot to fill a field that required a value...
Strange though, it didn\'t trow up an exception...
Logged


phunkydude
Newbie
*

Stars: +0/-0
Offline Offline

Posts: 4


WWW
« Reply #7 on: May 20, 2003, 10:55:12 am »

Hey CJ, new to the forum, how do I earn some ticks here (it\'s looking a bit stingy).
Logged

Slowhand
Supporters
*

Stars: +0/-0
Offline Offline

Gender: Male
Awards:
Topic Necromancer
Posts: 4668


I code C#!


WWW
« Reply #8 on: May 20, 2003, 11:03:47 am »

You\'ve got one.. smile
Logged


Pages: [1]   Go Up
Print
 
Jump to: