|
-
Jan 10th, 2002, 07:26 PM
#1
Thread Starter
Member
Make reference qry record source of form
Any advice appreciated. Beacon - took note of your comments, trying a diff approach!
Having problems getting image to load in an unbound object frame (imageFrame1), based on selction made in combo box.
Tried this code in Combo afterUpdate event:
Private Sub cboBridgeID_AfterUpdate()
Dim rs As DAO.Recordset
Dim db As DAO.Recordset
Dim strSQL As String
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[BridgeID] = " & Me![cboBridgeID]
Me.Bookmark = Me.RecordsetClone.Bookmark
Set db = CurrentDb
' have access load and run the qry
strSQL = "Select * from qryBridgePhotos where qry.ID=" & Me!cboBridgeID & ";"
Set rs = db.OpenRecordset(strSQL)
If rs.BOF And rs.EOF Then ' nothing to do
Else
'On Error Resume Next
Me![ImageFrame1].Picture = rs.Fields("9798_pht1")
End If
End Sub
Get type mismatch error(13). Look forward to your comments.
Nb it falls over at set db = Currentdb (= nothing) - why??
BridgeID is numeric.
-
Jan 11th, 2002, 04:56 AM
#2
Does this run the first time, but fail after that?
I notice that you never kill the db or rs variables. Try :
Code:
Me![ImageFrame1].Picture = rs.Fields("9798_pht1")
End If
If Not (rs is nothing) Then
rs.close
Set rs = nothing
End If
If Not (db is nothing) Then
Set db = nothing
End If
End Sub
-
Jan 11th, 2002, 05:05 AM
#3
Can I point out...
You are using a combo list right ?
So why not return the picture path/name in that combo box but make the column width 0...
Then after update, just grab the info from the column :
imgPiccy.picture=cboList.column(1)
Assuming MS Access there, but the principle should be the same for VB. I think the Vb would be using an array hidden on the form or something and the same extra column can be applied.
Regards
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|