Ok, here's the problem. I have one form, Details, which has a boat load of buttons on it. I created a "help" file, which gives descriptions for each button, and what it does. I have everything else working OK, but now comes the fun part. I am trying to read the button name from a table, and pass it to the picturedata of a 'display' button on the help form, which will change the picture show. I've done something similar on another form and it works fine, but that was hard-coding the picturedata source. Now, I'm trying to read it in from a table. In all honestly, I've been playing with this so long, my code looks like spaghetti. Need a fresh pair of eyes to tell me where I screwed up. Here's the code:
Option Compare Database
Dim cn As Connection
Dim rs As Recordset
Dim stButton As String
Private Sub Form_Load()
Set cn = CurrentDb.Connection
Set rs = New Recordset
rs.Open "tblButtonHelp", cn
End Sub
Public Sub Form_Current()
Dim stField As String
stField = Me.RecordID.Text
DoCmd.FindRecord stField
stButton = rs!ButtonName
Me.Button.PictureData = Form_Detail.stButton.PictureData
End Sub
Option Compare Database
Dim cn As Connection
Dim rs As Recordset
Dim stButton As String
Private Sub Form_Load()
Set cn = CurrentDb.Connection
Set rs = New Recordset
rs.Open "tblButtonHelp", cn
End Sub
Public Sub Form_Current()
Dim stField As String
stField = Me.RecordID.Text
DoCmd.FindRecord stField
stButton = rs!ButtonName
Me.Button.PictureData = Form_Detail.stButton.PictureData
End Sub