G
Guest
I'm relatively new to VBA. I thought it would have been very similar to VB
but I'm finding it a bit more difficult than anticipated. I am trying to
select one record using the value in a combox and have the result showing in
a text box. I get error 13 when I run the following code.
Private Sub Combo0_AfterUpdate()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim intNum As Integer
Dim strSQL As String
intNum = Me.Combo0
strSQL = "SELECT Picture.PositionDescription from picture where
Picture.pictureid=" & intNum
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
If Not rst.EOF Then
Text5 = rst
End If
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
I'm not sure if I'm missing a reference or syntax.
but I'm finding it a bit more difficult than anticipated. I am trying to
select one record using the value in a combox and have the result showing in
a text box. I get error 13 when I run the following code.
Private Sub Combo0_AfterUpdate()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim intNum As Integer
Dim strSQL As String
intNum = Me.Combo0
strSQL = "SELECT Picture.PositionDescription from picture where
Picture.pictureid=" & intNum
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
If Not rst.EOF Then
Text5 = rst
End If
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
I'm not sure if I'm missing a reference or syntax.