i have table...
a1 b1
a2 b2
a3 b3
a4 b4
a5 b5
. .
. .
. .
and randomly prints like...
blank blank
blank blank
blank blank
blank blank
a4 b4
a5 b5
. .
. .
. .
where blank can see being blank. cannot find character within record. code below. prints same number of records. using form , and calling in table name table.
option compare database sub concatenate(table string) ' set database 'dim dbscyme_model_update dao.database 'dim rst dao.recordset set dbscyme_model_update = currentdb dim field string 'count records , fields recordcount = currentdb.tabledefs(table).recordcount fieldcount = currentdb.tabledefs(table).fields.count debug.print "00000"; recordcount; fieldcount; recordcounter = 0 redim fieldarray(0) string redim recordarray(0) string redim fieldarray(fieldcount - 1) string redim recordarray(recordcount - 1) string set rst = dbscyme_model_update.openrecordset(table) rst.movefirst until rst.eof 'field data fieldcounter = 1 while fieldcounter < fieldcount 'set recordset field = "field" & fieldcounter 'rstgeneral fieldstring = rst.fields(field) fieldarray(fieldcounter - 1) = fieldstring fieldcounter = fieldcounter + 1 wend printcounter = 0 each element in fieldarray if not fieldarray(printcounter) = "n/a" holder = recordarray(recordcounter) if fieldarray(printcounter + 1) = "n/a" recordarray(recordcounter) = holder + fieldarray(printcounter) else recordarray(recordcounter) = holder + fieldarray(printcounter) + "," end if printcounter = printcounter + 1 end if next element recordcounter = recordcounter + 1 rst.movenext loop rst.close set rst = nothing dim temp string 'print cymeimportfile dim bob string bob = 0 set rst = dbscyme_model_update.openrecordset("cymeimportfile") 'rst.movefirst recordcounter = 0 if rst.bof rst.addnew rst.update rst.moveprevious else rst.movelast rst.movenext rst.addnew rst.update rst.moveprevious end if each element in recordarray rst.edit temp = recordarray(recordcounter) rst!field1 = temp rst.update rst.movenext if rst.eof rst.addnew rst.update rst.moveprevious end if recordcounter = recordcounter + 1 next element rst.close set rst = nothing redim fieldarray(0) string redim recordarray(0) string end sub
i figured out. different adds , updates confused everything. simplified down this.
new code:
'print cymeimportfile dim bob string bob = 0 set rst = dbscyme_model_update.openrecordset("cymeimportfile") recordcounter = 0 rst.movelast rst.addnew each element in recordarray 'rst.edit rst.addnew temp = recordarray(recordcounter) rst!field1 = temp rst.update recordcounter = recordcounter + 1 next element rst.close set rst = nothing redim fieldarray(0) string redim recordarray(0) string debug.print table end sub
Comments
Post a Comment