for loop - Populate a series of textboxes with random values in Access - run time error 3021 No current record -


i'm trying populate series of textboxes random value column. first textbox filled returns run time error 3021 - no current record. checked values , record i'm trying retrieve doesn't exceed recordcount table. debug colours rs.move randomrecord.

    dim rs dao.recordset     dim recordcount long     dim randomrecord long      set rs = currentdb.openrecordset("select * besede")     rs.movelast     rs.movefirst     recordcount = rs.recordcount - 1     msgbox recordcount     randomize     dim integer      = 1 10        randomrecord = int((recordcount) * rnd)        rs.move randomrecord        controls("t" & i).setfocus        controls("t" & i) = rs!test     next 

you moving cursor current position, trying read record @ end of recordset. use

rs.movefirst before rs.move randomrecord

to move beginning of recordset.

check office dev center more background information on recordset.move.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -