I am creating a simple database for my employer but VB coding baffles me and I am stuck on the last portion of it. Some help would be greatly appreciated as I have been working on this particular coding for two days by trying different variations and researching online.
Here's what I have:
Parent form : woinstrfrm
subform control: wolabfrm
Subform name: wolabfrm_sub
I have a <searchfrm> which allows the user to pull up a particular record on the main form based on search parameters. Two of those parameters reference the parent form and they work properly. The last search I need to filter to a record on the subform <Instorder> so it shows the associated parent form and that particular record in the subform (ideally I would prefer it didn't filter the subform but just displayed that record). The name of the text box on my search form is <IOtxtbx>
I have tried the following:
Private Sub IOsearch_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "woinstrfrm"
stLinkCriteria = "Forms![woinstrfrm].[wolabfrm].Form[Instorder] = " & Me.IOtxtbx
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
This gives me a syntax error 3075
So I tried this:
Private Sub IOsearch_Click()
Dim stDocName As String
stDocName = "woinstrfrm"
DoCmd.OpenForm stDocName
With Forms![woinstrfrm]![wolabfrm].Form
.Filter = "Me!IOtxtbx = Forms![woinstrfrm].[wolabfrm].Form[Instorder]"
.FilterOn = True
End With
End Sub
This opens the form but not to the proper record. I've been looking online and trying to adapt other formulas I've seen that are similar to my project. As I've said I'm really clueless and would appreciate any insight into my problem.
Thank you!