i running code split slash-separated field multiple rows, first value in series not carrying over. know i'm missing. also, rows have 1 record not carrying over.
public sub reformattable() dim db dao.database dim rs dao.recordset dim rsadd dao.recordset dim strsql string dim strmpg, strbusinessname, strcustomernumber, strcustomername, strcountstartdate, strccstatus string dim strsplitmpg string dim vardata variant dim integer set db = currentdb ' select eligible fields (have comma) , unprocessed (split_mpg null) strsql = "select business_name, customer_number, customer_name, count_start_date, cc_status, mpg, split_mpg [tmstarcyclecountstatuses_slashesforcommas] ([mpg] ""*/*"") , ([split_mpg] null)" set rsadd = db.openrecordset("tmstarcyclecountstatuses_slashesforcommas", dbopendynaset, dbappendonly) set rs = db.openrecordset(strsql, dbopendynaset) rs while not .eof strmpg = !mpg strbusinessname = !business_name strcustomernumber = !customer_number strcustomername = !customer_name strcountstartdate = !count_start_date strccstatus = !cc_status vardata = split(strmpg, "/") ' comma delimited fields ' update first record .edit !split_mpg = trim(vardata(0)) ' remove spaces before writing new fields .update ' add records same first field ' , new fields remaining data @ end of string = 1 ubound(vardata) rsadd .addnew !mpg = strmpg !split_mpg = trim(vardata(i)) ' remove spaces before writing new fields !business_name = strbusinessname !customer_number = strcustomernumber !customer_name = strcustomername !count_start_date = strcountstartdate !cc_status = strccstatus .update end next .movenext wend .close rsadd.close end set rsadd = nothing set rs = nothing db.close set db = nothing
end sub
i can't post images yet due reputation constrictions, here links.
here's multiple after code: https://s9.postimg.org/fn3u70b5b/multiple.jpg
here's single records after code run: https://s10.postimg.org/bfq9z4snt/singles.jpg
i feel there's super simple i'm missing here, looks i'm taking mpg over, i'm curious why i'm not getting singles or first of series. appreciated! thank you.
it looks right me, except have declare this:
dim strmpg string dim strbusinessnames string dim strcustomernumbers string dim strcustomernames string dim strcountstartdates string dim strccstatus string
i guess have insert lines debug.print ..
narrow down happenings.
Comments
Post a Comment