help: can't get 2 images to be viewable on form

  • Thread starter reservedbcreater
  • Start date
R

reservedbcreater

sorry bout all the trouble im giving u guys but everything has helped me so
far.

i got my form working perfectly in that i used pictureload2k and used its
code on my DB and i can use a open file dialoge to choose a picture then
it loads it up on the form just like i wanted.

problem now is -there are 2 pics on each form and i dunno y but the code
wont work for 2 pics???

i have imgstock and imgstock1 and i have txtstockgraph and
txtstockgraph1...but if i put:
Me.ImgStock.Picture = Me.txtStockGraph
me.ImgStock1.Picture = me.txrStockGraph1
i get an error when trying to open form
i have a second chooseafile called chooseafile1 as well...

my code:

Option Compare Database
Option Explicit
Dim Filename As String, pathname As String

Private Sub Form_Activate()
pathname = "C:\"
End Sub

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImgStock.Picture = Me.txtStockGraph


Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If Err.Number = 2220 Then 'can't find the file
Resume Next
ElseIf Err.Number = 94 Then 'invalid use of null
Me.ImgStock.Picture = ""

Resume Next
Else
MsgBox Err.Description
Resume Exit_cmdClose_Click
End If
End Sub


Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim intResponse As Integer

intResponse = MsgBox("Save Record?", vbYesNoCancel)

Select Case intResponse
Case vbYes
'Do Nothing
Case vbNo
Me.Undo 'To undo the edit
Case vbCancel
Cancel = True 'To cancel the update & hence the close
End Select

End Sub


Private Sub Cmd75_Click()

Dim strDocName As String
Dim strID As String

strDocName = "Edit: Water"

DoCmd.Close
DoCmd.OpenForm strDocName

End Sub


Private Sub cmdChooseAFile_Click()

Dim strFilter As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Picture Formats (*.jpg
*.jpeg, *.bmp, *.gif)", "*.jpg; *.jpeg; *.bmp; *.gif")
'MsgBox "You selected: " &
Filename = ahtCommonFileOpenSave(InitialDir:=pathname, _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select Picture File")
'display picture
Me.txtStockGraph = Filename
Me.ImgStock.Picture = Filename
 
R

reservedbcreater

sorry guys i figured it out, hate to bother u. just had to create a
variable for the 2nd filename
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top