Unanswered: LinkMasterFields, to unbound textbox
Apparently the below piece of code wont work, and as far as I can see it, its due tot the fact that the masterfield is an unbound object.
The whole idea is, that if the user chooses an invoice number, this little proc will link a subform with the information. Plus, in the end, fetch a commentary field from another table, and add this to a textbox.
The proc fails on the linkmasterfields, regardles how i enter the box_faktura textbox value / field reference..
If IsNull(box_faktura.Value) = False Then
Dim qdf As QueryDef
Dim Curdb As Database
Set Curdb = CurrentDb()
Set qdf = Curdb.CreateQueryDef("")
Dim kommrs As Recordset
subform_tracks.SourceObject = md_subform_kopfak_tracks
subform_tracks.LinkMasterFields = box_faktura.Value
subform_tracks.LinkChildFields = "faknr"
.sql = "SELECT * FROM md_tbl_kopfak WHERE faknr =" & box_faktura.Value
Set kommrs = .OpenRecordset(dbOpenSnapshot)
End With ''
txt_komm.Value = kommrs!kommentar
IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....