• WSD Willett

    WSD Willett

    @wsd-willett

    Viewing 15 replies - 2,461 through 2,475 (of 2,497 total)
    Author
    Replies
    • in reply to: Populate Listbox (WIN2000-Acc97) #600687

      I shall go along with your recommendations greatfully.

      There is nothing wrong with nit picking..

      Thanks

      Dave

    • in reply to: Populate Listbox (WIN2000-Acc97) #600682

      Hans

      You caught me out again, Yes i’m a little scruffy where code is concerned.
      I promise to use the Select Case in the future and I will write it out 100 times as punishment.

      Edited. The select case did the trick.
      Thanks Hans.
      Any other recommendations would be appreciated on my code.
      Dave

    • in reply to: Populate Listbox (WIN2000-Acc97) #600670

      Check the code (cmdInsertPic) this uses a common dialog box.
      This opens at a specified drive and folder but with the option to browse any drive & folder.
      You will need the (on current) event also.

      As you see mines a little bit of a hybrid to say the least. I will eventually remove the common dialog once I get it to work correctly.

      I think the fault in my code is the (on Current) event conflicting.

      Dave

    • in reply to: Populate Listbox (WIN2000-Acc97) #600552

      Hers pic2 showing the navigation bar and the fields at the top of the form

    • in reply to: Populate Listbox (WIN2000-Acc97) #600551

      The whole thing is working but I have a knawing problem with it.

      Perhaps if I break it down, some-one will see whats happening.
      Now, when I try to open the form, if there is no record, then the message box states the obvious, “You have no images”
      ———————————————————————————————————————————————
      Private Sub Form_Open(Cancel As Integer)
      DoCmd.Close acForm, “frmCreateEstimate”, acSaveYes
      If Me.RecordsetClone.RecordCount = 0 Then
      MsgBox “You Have No Current Images For This File, Press OK”
      Me.lstPreviewJpgs.SetFocus
      End If
      End Sub
      —————————————————————————————–

      Press ok and the form opens with all blank fields waiting for a selected picture.

      The user has the focus in the list (lstPreviewJpgs) and uses the up / down arrow keys to go to a selection. This part is fine and the previewOLE (ignore OLE, its only a name) changes ok as it should.
      ——————————————————————————————
      Private Sub lstPreviewJpgs_AfterUpdate()
      Me!PreviewOLE.Picture = “L:Home” & Me!lstPreviewJpgs
      Forms!frmImages.SetFocus
      Forms!frmImages.lstPreviewJpgs.SetFocus
      End Sub
      —————————————————————————————————————————————

      Now, here’s where the glitch is, on KeyDown the user press’s Enter when he has reached the picture of his selection.
      ————————————————————————————-
      Private Sub lstPreviewJpgs_KeyDown(KeyCode As Integer, Shift As Integer)
      If KeyCode = vbKeyReturn Then
      DoCmd.GoToRecord , , acNewRec
      Me.EstimateNo = Forms!frmDetails!EstimateNo
      Me.supp = Forms!frmDetails!supp
      Me.txtRegistration = Forms!frmDetails!Registration
      Me.PicFile = “L:Home” & Me.lstPreviewJpgs
      ‘Me.PicFile = Me.lstPreviewJpgs
      Me.[imgPicture].Picture = [PicFile]
      DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
      Forms!frmImages.SetFocus
      Forms!frmImages.lstPreviewJpgs.SetFocus
      Else
      End If
      On Error GoTo errtrap
      If KeyCode = vbKeyPageUp Then Me.txtRegistration.SetFocus
      If KeyCode = vbKeyPageUp Then DoCmd.GoToRecord , , acPrevious
      If KeyCode = vbKeyPageDown Then Me.txtRegistration.SetFocus
      If KeyCode = vbKeyPageDown Then DoCmd.GoToRecord , , acNext
      errtrap:
      Exit Sub
      End Sub
      ——————————————————————————————————————-

      The code correctly assigns EstimateNo, Supp, Registration into a new record, saves it BUT, Looking at the navigation bar at the bottom of the form, the record number is now 2.
      Its saved the first record with all ness details but moved over to record number 2.
      If the form is closed and re-opened, the correct record number is at 1.

      Below I have pasted all the code from the form in case I have missed something.
      —————————————————————————-
      —————————————————————————-

      Option Compare Database
      Option Explicit

      Public Function Proper()
      Screen.ActiveControl = StrConv(Screen.ActiveControl, vbProperCase)
      End Function

      Private Sub cmdClose_Click()
      On Error Resume Next
      DoCmd.Close acForm, Me.Name
      End Sub

      Private Sub cmdErasePic_Click()
      If Not IsNull([PicFile]) Then
      If MsgBox(“The image will be removed from this record. Are you sure?”, vbYesNo + vbQuestion) = vbYes Then
      [imgPicture].Picture = “”
      [PicFile] = Null
      [EstimateNo] = Null
      [supp] = Null
      [Registration] = Null
      [ImageCreated] = Null
      [Comment] = Null
      DoCmd.SetWarnings False
      DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
      DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
      DoCmd.SetWarnings True
      SysCmd acSysCmdClearStatus
      Forms!frmImages.Requery
      End If
      End If
      End Sub

      Private Sub cmdInsertPic_Click()
      If Me.RecordsetClone.RecordCount = 0 Then MsgBox “You No Current Images For This File, Press OK”
      Dim OFN As OPENFILENAME
      On Error GoTo Err_cmdInsertPic_Click
      DoCmd.GoToRecord , , acNewRec
      Me.EstimateNo = Forms!frmDetails!EstimateNo
      Me.supp = Forms!frmDetails!supp
      Me.txtRegistration = Forms!frmDetails!Registration
      ‘ Set options for dialog box.
      With OFN
      .lpstrTitle = “Images”
      If Not IsNull([PicFile]) Then .lpstrFile = [PicFile]
      .lpstrInitialDir = “L:home”
      .flags = &H1804 ‘ OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
      .lpstrFilter = MakeFilterString(“Image files (*.bmp;*.gif;*.jpg;*.wmf)”, “*.bmp;*.gif;*.jpg;*.wmf”, _
      “All files (*.*)”, “*.*”)
      End With
      If OpenDialog(OFN) Then
      [PicFile] = OFN.lpstrFile
      [imgPicture].Picture = [PicFile]
      SysCmd acSysCmdSetStatus, “Image Loaded: ‘” & [PicFile] & “‘.”
      Forms!frmImages.SetFocus
      Me.EstimateNo.SetFocus
      DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
      End If
      Exit Sub
      Err_cmdInsertPic_Click:
      MsgBox Err.Description, vbExclamation
      End Sub

      Private Sub cmdPreview_Click()
      On Error GoTo HandleErr
      Dim intButSelected As Integer, intButType As Integer
      Dim strMsgPrompt As String, strMsgTitle As String
      strMsgPrompt = “You Have Selected To Print, Do You Want To Continue !!”
      strMsgTitle = “Printing ”
      intButType = vbYesNo + vbDefaultButton2
      intButSelected = MsgBox(strMsgPrompt, intButType, strMsgTitle)
      If intButSelected = vbYes Then
      If IsNull([EstimateNo]) Then
      MsgBox “There is no data for this report. Canceling report…”, vbInformation
      Else
      RunCommand acCmdSaveRecord
      DoCmd.OpenReport “Image Thumbs”, acNormal, , “[EstimateNo] = ” & [EstimateNo]
      Forms!frmImages.SetFocus
      Forms!frmImages!EstimateNo.SetFocus
      If intButSelected = vbNo Then
      Forms!frmImages.SetFocus
      Forms!frmImages!EstimateNo.SetFocus
      End If
      End If
      End If
      Exit Sub
      HandleErr:
      MsgBox Err.Description, vbExclamation
      End Sub

      Private Sub Command64_Click()
      ‘setfocu back to the list box
      Me.lstPreviewJpgs.SetFocus
      End Sub

      Private Sub Form_Close()
      On Error GoTo errtrap
      Forms!frmDetails.SetFocus
      Forms!frmDetails!DummyEst.SetFocus
      Exit Sub
      errtrap:
      End Sub

      Private Sub Form_Current()
      On Error GoTo HandleErr
      If Not IsNull([PicFile]) Then
      Me.[imgPicture].Picture = [PicFile]
      SysCmd acSysCmdSetStatus, “Image: ‘” & [PicFile] & “‘.”
      Else
      ‘[imgPicture].Picture = “”
      SysCmd acSysCmdClearStatus
      End If
      Exit Sub
      HandleErr:
      If Err = 2220 Then
      ‘[imgPicture].Picture = “”
      SysCmd acSysCmdSetStatus, “Can’t open image: ‘” & [PicFile] & “‘”
      Else
      MsgBox Err.Description, vbExclamation
      End If
      End Sub

      Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
      If KeyCode = vbKeyF5 Then Call cmdClose_Click
      If KeyCode = vbKeyF3 Then Call cmdInsertPic_Click
      If KeyCode = vbKeyF6 Then Call cmdPreview_Click
      If KeyCode = vbKeyF2 Then Call Command64_Click
      If KeyCode = vbKeyDelete Then Call cmdErasePic_Click
      End Sub

      Private Sub Form_Open(Cancel As Integer)
      DoCmd.Close acForm, “frmCreateEstimate”, acSaveYes
      If Me.RecordsetClone.RecordCount = 0 Then
      MsgBox “You Have No Current Images For This File, Press OK”
      Me.lstPreviewJpgs.SetFocus
      End If
      End Sub

      Private Sub Command55_Click()
      ‘Opens the report
      On Error GoTo Err_Command55_Click
      Dim stDocName As String
      stDocName = “Image Thumbs”
      DoCmd.OpenReport stDocName, acNormal
      Exit_Command55_Click:
      Exit Sub
      Err_Command55_Click:
      MsgBox Err.Description
      Resume Exit_Command55_Click
      End Sub

      Private Sub lstPreviewJpgs_AfterUpdate()
      Me!PreviewOLE.Picture = “L:Home” & Me!lstPreviewJpgs
      Forms!frmImages.SetFocus
      Forms!frmImages.lstPreviewJpgs.SetFocus
      End Sub

      Private Sub lstPreviewJpgs_KeyDown(KeyCode As Integer, Shift As Integer)
      If KeyCode = vbKeyReturn Then
      DoCmd.GoToRecord , , acNewRec
      Me.EstimateNo = Forms!frmDetails!EstimateNo
      Me.supp = Forms!frmDetails!supp
      Me.txtRegistration = Forms!frmDetails!Registration
      Me.PicFile = “L:Home” & Me.lstPreviewJpgs
      Me.[imgPicture].Picture = [PicFile]
      DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
      Forms!frmImages.SetFocus
      Forms!frmImages.lstPreviewJpgs.SetFocus
      Else
      End If
      On Error GoTo errtrap
      If KeyCode = vbKeyPageUp Then Me.txtRegistration.SetFocus
      If KeyCode = vbKeyPageUp Then DoCmd.GoToRecord , , acPrevious
      If KeyCode = vbKeyPageDown Then Me.txtRegistration.SetFocus
      If KeyCode = vbKeyPageDown Then DoCmd.GoToRecord , , acNext
      errtrap:
      Exit Sub
      End Sub
      ——————————————–
      ——————————————–

      This really stumping me.
      Dave

    • in reply to: IsNull Combo (A2000) #600478

      You know.
      I could sit for hours just posting these little glitches.
      Hope to be of service to others at some time.
      Thanks Francois.

      Dave

    • in reply to: Up – Down Keys (A2000) #600475

      I have this on each field in the form.
      I’ve also tried tried this cursor behaviour from options but don’t like how it re-acts in certain places.
      Wonder if there is a remedy without using Keycode=vbkeyup / down

      Dave

    • in reply to: Up – Down Keys (A2000) #600473

      I have codes in the key events on both forms but I think this is causing the prob: –

      me!Whatever.selStart = me!Whatever.selLength ??????

      In the on_enter of the field

      Dave

    • in reply to: Populate Listbox (WIN2000-Acc97) #600464

      Slightly different but it now works

      If KeyCode = vbKeyReturn Then
      DoCmd.GoToRecord , , acNewRec
      Me.EstimateNo = Forms!frmdetails!EstimateNo
      Me.supp = Forms!frmdetails!supp
      Me.txtRegistration = Forms!frmdetails!Registration
      Me.PicFile = “L:Home” & Me.lstPreviewJpgs
      ‘Me.PicFile = Me.lstPreviewJpgs

      Me.[imgPicture].Picture = [PicFile]
      DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
      Forms!frmImages.SetFocus
      Forms!frmImages.lstPreviewJpgs.SetFocus
      Else

      Thanks.
      Dave

    • in reply to: Populate Listbox (WIN2000-Acc97) #600288

      If KeyCode = vbKeyReturn Then
      DoCmd.GoToRecord , , acNewRec
      Me.EstimateNo = Forms!frmdetails!EstimateNo
      Me.supp = Forms!frmdetails!supp
      Me.txtRegistration = Forms!frmdetails!Registration
      Me.PicFile = Me.lstPreviewJpgs
      Me.[imgPicture].Picture = [PicFile]
      Me.lstPreviewJpgs.SetFocus

      I use this on keydown with the list.

      The problem is [PicFile] is a field on my form and requires the full path to allow [imgPicture] to work correctly.

      At the moment lstPreviewJpgs will return (example) 123.jpg to [picfile] instead of L:Home123.jpg

      Can any-one help with this.

      Dave

    • in reply to: Common Dialog (A2000) #600188

      Thanks all for the help, I found this ( directed from world forums) ( Thanks cpod ) but haven’t tried it yet.
      I’ll let you know how things go.

      Dave

      http://www.wopr.com/cgi-bin/w3t/showflat.p…;o=0&fpart=[/url]

      Edited by Charlotte to activate link

    • in reply to: Populate Listbox (WIN2000-Acc97) #600209

      Thanks for that, Perfect

      Dave

    • in reply to: Populate Listbox (WIN2000-Acc97) #600202

      I am using A2000 and have implemented this code and procedure for exactly the same procedure.
      My list box fills with the JPG names from my designated folder, all ok.

      When I click in the list box though, I get run-time 438 error.
      I’ve had this prob before in other forms and stuff and been able to fix it.

      However, I cannot find the problem in this instance. I presume it is the difference in A97 & A2000.

      How can I remedy this 438 fault.

      Dave

    • in reply to: Common Dialog (A2000) #599970

      Hans
      I’ve searched and none of the examples really meet my needs.
      Not heard of the callback function before.

      My Images are located on L:Home???.jpg

      Could you explain a little more in depth.

      Dave

    • in reply to: Common Dialog (A2000) #599957

      Perhaps the custom form is the better option for me, not sure what would happen on a run-time if word wasn’t on the pc.

      Any directions in creating this form would be appreciated.
      I do not store the images via OLE only the path.

      Dave

    Viewing 15 replies - 2,461 through 2,475 (of 2,497 total)