By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 2,966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

Dynamic Linkmasterfields

P: 1

I have an unbound form on which there are 3 controls: option group, combo box and a subform. The value of the combo box depends on the value of the option group and the value of link child field depends on the value of the combo box. here is the code:
Expand|Select|Wrap|Line Numbers
  1. Dim stSQL As String, stCriteria As String, stDocNo As String
  3. stDocNo = Me.cboDocNo
  5. If Frame4.Value = 1 Then
  6.     stSQL = "SELECT [DeliveryNotes].[DeliveryNote], [DeliveryNotes].[Consignee], [DeliveryNotes].[Description], "
  7.     stSQL = stSQL & "[DeliveryNotes].[ClientID] FROM [DeliveryNotes]"
  8. Else
  9.     stSQL = "SELECT [ExpiryDates].[ItemTransID], [ExpiryDates].[InvoiceNo], [ExpiryDates].[Description] "
  10.     stSQL = stSQL & "FROM [ExpiryDates]"
  11. End If
  13. Me.cboDocNo.RowSource = stSQL
  14. Me.DeliveryTrans.LinkMasterFields = stDocNo
  15. If Frame4.Value = 1 Then
  16.     Me.DeliveryTrans.LinkChildFields = "[DeliveryNoteNo]"
  17. Else
  18.     Me.DeliveryTrans.LinkChildFields = "[InvoiceNo]"
  19. End If
  21. Me.cboDocNo.Requery
This code is set to run when the option group is updated but I'm getting a runtime error. I'm actually prompted for a parameter value. If the value of the combop box (stDocNo) is, for example, 5 I'm prompted for a parameter value of 5. If I haven't entered anything yet I get "Invalid use of null" error. Is there something I'm missing? Please help.


Nov 18 '08 #1
Share this Question
Share on Google+
1 Reply

P: 2
would a discrepancy in name be an issue

Me.DeliveryTrans.LinkChildFields = "[DeliveryNoteNo]"

stSQL = "SELECT [DeliveryNotes].[DeliveryNote],

Nov 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.