I need it to display data when I open up the main form, txtStatusID is already set when opening it up, while creating an invoice its value is set to 0 by default, then I need to display data in subform, which has continuous form linked to it, that belong to the Client I choose from above from dropdown, subform has master and child fields set to their primary key ID which should return data that for the client who was selected. But when an old invoice, which is just submitted, is opened up then StatusID is already set to 100 (if submitted) and 200 (if marked paid, think i mentioned wrong number above but it doesn't matter). And now I need the subform to display me results that are returned from another query, where specific sales are linked to that invoice. Hope it makes sense.
I tried this in main forms Form OnLoad:
Code:
With sbfSalesComplete.Form
If txtStatusID.Value > 100 Then
.RecordSource = "qrySalesComplete"
Else
.RecordSource = "qrySalesInvoiced"
End If
End With
but I am not getting anything, tried to add different values to watchlist while debugging it in vba editor and nothing.
Then I also switched things around and made 2 new continuous forms, one with qrySalesCompleted record source and another with qrySalesInvoiced. Then to OnLoad I added:
Code:
If txtStatusID.Value > 100 Then
Me.sbfSalesComplete.SourceObject = "frmCompletedSales"
Else
Me.sbfSalesComplete.SourceObject = "frmCompletedInvoices"
End If
..and I am getting nothing. Not sure where the problem is, not very familiar with access too. Tried to add requery after every setting too.