Private Sub PubName_AfterUpdate()
Dim sql As String
sql = "select PubCode from Publisher where PubName = '" &
PubName.Value & "';"
Set rst = CurrentDb.OpenRecordset(sql)
MsgBox sql
If Not rst.BOF Then
rst.MoveFirst
End If
PubCode.Value = rst(0) <-- error
End Sub
PubCode is a text box and PubName is a combo box.
I have a table like this:
Publisher: PubCode, PubName
and my form is like that...
If I selected a PubName in PubName combo box, I want to change the
PubCode correspondingly, since they are actually refering the same
tuple.
But When I use the above code...
run time error 3331 occur sayign that
To make change in this field, first save the record.
I am getting dizzy~~
Can anyone help?
Thx~