Hey Folks,
I'm getting a really strange behaviour from an embedded browse on a form. I've attached a link to a video that shows the issue.
I'm updating an old VB6/Access database. I'm stilling using the Access tables and getting to them via Linked tables. The form is based on a 1:Many set. The many side is displayed in the embedded browse.
The embedded browse contains the text location of an image and I display the image as each record is clicked on.
I print a report for the main information on the form, plus the images from the browse.
Printing an image is a problem because the Alpha Image control needs an Image File Reference Field. But I have Access tables... so... I created Alpha DBF tables just for printing. In code, I open the DBF and Linked tables, select my records, and copy from the Linked table to the DBF table... then print.
Doing this record copy, however, causes my embedded browse to go kinda funny... and I have no idea why. I'm hoping someone has run into this. The code I'm running to copy the records is below as well... it's quite straight forward... or so I think. The code copies the main record and then the images records. It's the images record copying that is causing the odd behaviour. I thought I could open the same table as the browse is based on, in code, and copy the records. I'm not changing them, but I am selecting them. I thought the code would be separated from the Form.
Here's the video link... watch the Image # in the embedded browse... it changes. If I put in server refreshes it helps... but only sometimes. And sometimes... the records disappear altogether. If I click on the browse they'll return. Thanks so much for looking.
http://screencast.com/t/c6toab9w
and here's the code I run...
I'm getting a really strange behaviour from an embedded browse on a form. I've attached a link to a video that shows the issue.
I'm updating an old VB6/Access database. I'm stilling using the Access tables and getting to them via Linked tables. The form is based on a 1:Many set. The many side is displayed in the embedded browse.
The embedded browse contains the text location of an image and I display the image as each record is clicked on.
I print a report for the main information on the form, plus the images from the browse.
Printing an image is a problem because the Alpha Image control needs an Image File Reference Field. But I have Access tables... so... I created Alpha DBF tables just for printing. In code, I open the DBF and Linked tables, select my records, and copy from the Linked table to the DBF table... then print.
Doing this record copy, however, causes my embedded browse to go kinda funny... and I have no idea why. I'm hoping someone has run into this. The code I'm running to copy the records is below as well... it's quite straight forward... or so I think. The code copies the main record and then the images records. It's the images record copying that is causing the odd behaviour. I thought I could open the same table as the browse is based on, in code, and copy the records. I'm not changing them, but I am selecting them. I thought the code would be separated from the Form.
Here's the video link... watch the Image # in the embedded browse... it changes. If I put in server refreshes it helps... but only sometimes. And sometimes... the records disappear altogether. If I click on the browse they'll return. Thanks so much for looking.
http://screencast.com/t/c6toab9w
and here's the code I run...
Code:
'First... save record in current form at parent level. topparent.commit() 'So... what report are we running? Dim reorderPrt as L reOrderPrt = .f. currRptFormat = Var->rptFormat if isNull(currRptFormat) then ' currRptFormat = "Photo Sheet - Main - 2 Images" Msgbox("Digital Adjuster","Please select a Photo Sheet") end end if dim filterstring as c dim currCmpy as c filterstring = "RptName = " + s_quote(currRptFormat) rptSelected = lookup("tblReportFormats",filterstring,"rptDesc") if isNull(rptSelected) then Msgbox("Digital Adjuster","Photo Sheet not found") end end if 'ui_msg_box("Report", rptSelected) 'end 'Clear the temporary Print DBF tables query.filter = "" query.order = "" Dim currClmNbr as C currClmNbr = :frmClaims:claimnbr.text DIM operation_name as c operation_name = "qry_DelPrtClaims" If operation_name <> "" then mark.run_silent(operation_name,query.filter) End if query.filter = "" query.order = "" operation_name = "qry_DelPrtClaimImages" If operation_name <> "" then mark.run_silent(operation_name,query.filter) End if 'Now... copy over the current Claim t = table.open("tblClaims") tidx = t.order("","Claimnbr = '" + currClmNbr + "'") if tidx.records_get() > 0 then t.fetch_first() t2 = table.open("prt_tblclaims") while .not. t.fetch_eof() record_data = t.record_data_get() t2.enter_begin() t2.record_data_set(record_data) t2.enter_end(.T.) t.fetch_next() End While t2.close() else end End if tidx.drop() t.close() 'Now... copy over the current Claim Images 'But... we need to copy and rotate the original images 'ImagePrtNbr Dim fnout as C Dim currFN as C Dim currPath as C Dim currFileName as C Dim imgCnt as N t = table.open("tblClaimImages") imgCnt = 1 currPath = a5.Get_Path() tidx = t.order("ImagePrtNbr","Clmnbr = '" + currClmNbr + "' .AND. ImagePrt = .t.") if tidx.records_get() > 0 then t.fetch_first() t2 = table.open("prt_tblclaimimages") while .not. t.fetch_eof() If imgCnt = 5 then imgCnt = 1 end if currFT = file.filename_parse(t.ImageLoc, "e") currFN = t.ImageNbr + currFT fnout = currPath + "\Print_Images\\" + currFN If t.ImageRotate = 0 then nbrRotate = 0 else nbrRotate = t.ImageRotate end if IMRotate = "-rotate " + nbrRotate currFileName = t.ImageLoc pResult = a5_runImageMagicCommand(currFileName , fnout , IMRotate) record_data = t.record_data_get() t2.enter_begin() t2.record_data_set(record_data) 'The Image File Reference field isnt' copying property... set it directly t2.ImageLoc = fnout t2.ImageName = t.ImageName 'Because Alpha reports run in columns...we need to reorder the images to show in print properly... like a Z order 'msg = "This is ImagePrtNbr " + t.ImagePrtNbr if reOrderPrt = .t. then if imgCnt = 2 then t2.ImageSeq = t.ImagePrtNbr + 1 else if imgCnt = 3 then t2.ImageSeq = t.ImagePrtNbr - 1 else t2.ImageSeq = t.ImagePrtNbr end if end if else t2.ImageSeq = t.ImagePrtNbr end if t2.enter_end(.T.) t.fetch_next() imgCnt = imgCnt + 1 End While t2.close() else tidx.drop() t.close() end End if tidx.drop() t.close() 'xbasic_wait_for_idle() :frmClaims:brs_claim_images.ServerSideRefreshAll() 'topparent.ServerSideRefreshAll() 'xbasic_wait_for_idle() 'justreport: 'PREVIEW_REPORT(useRpt, "", "", .t., .t.) PREVIEW_REPORT(rptSelected, "", "", .t., .t.) 'xbasic_wait_for_idle() ':frmClaims:brs_claim_images.ServerSideRefreshAll() 'topparent.ServerSideRefreshAll() Proc_Exit: end Proc_Err: err = error_code_get() msg = error_text_get(err) ui_msg_box("Digital Adjuster", "Error # : " + err + " : " + msg) resume Proc_Exit
Comment