Hi
I have a database collecting patient information - its all based on one form called [TRAUMA DATABASE] which uses the table [TRAUMA DATABASE] (Access 2003)
To make it simple enough for surgeons to use, i created a intro form with big buttons called [Intro] - these are seperate forms in the same DB (not subform).
One says "Name search" next to an unbound textbox called "Name_Search"
In the afterupdate VBA i have the following code:
Private Sub Name_Search_AfterUpdate()
Dim stfilter As String
stfilter = stfilter & "([Name] Like ""*" & Me.Name_Search & "*"")"
Forms![TRAUMA DATABASE].Filter = stfilter
Forms![TRAUMA DATABASE].FilterOn = True
End Sub
^^ This is meant to take the value in the textbox and filter the [TRAUMA DATABASE] forms by partial match to the name field in [Name]. [Name] is used in [TRAUMA DATABASE] but not [INTRO]
I get the error message: "Run-time error '2450': Microsoft Office Access can't find the form 'TRAUMA DATABASE' referred to in a macro expression or Visual Basic Code"
The debug takes me back to:
Forms![TRAUMA DATABASE].Filter = stfilter
I tried searching from the [TRAUMA DATABASE] form with a textbox with the following VBA:
Private Sub Name_Search_AfterUpdate()
Dim stfilter As String
stfilter = stfilter & "([Name] Like ""*" & Me.Name_Search & "*"")"
Me.Form.Filter = stfilter
Me.Form.FilterOn = True
End Sub
This works fine so i guess i must just have the wrong syntax at
Forms![TRAUMA DATABASE].Filter = stfilter
I've tried to solve it myself, ive read hours and hours of forums but now im admitting defeat
- please can i have some help
Do i have to make one form a subform of the other?
I know i could use queries etc but that seems to be overcomplicating something that should be very simple...
I have a database collecting patient information - its all based on one form called [TRAUMA DATABASE] which uses the table [TRAUMA DATABASE] (Access 2003)
To make it simple enough for surgeons to use, i created a intro form with big buttons called [Intro] - these are seperate forms in the same DB (not subform).
One says "Name search" next to an unbound textbox called "Name_Search"
In the afterupdate VBA i have the following code:
Private Sub Name_Search_AfterUpdate()
Dim stfilter As String
stfilter = stfilter & "([Name] Like ""*" & Me.Name_Search & "*"")"
Forms![TRAUMA DATABASE].Filter = stfilter
Forms![TRAUMA DATABASE].FilterOn = True
End Sub
^^ This is meant to take the value in the textbox and filter the [TRAUMA DATABASE] forms by partial match to the name field in [Name]. [Name] is used in [TRAUMA DATABASE] but not [INTRO]
I get the error message: "Run-time error '2450': Microsoft Office Access can't find the form 'TRAUMA DATABASE' referred to in a macro expression or Visual Basic Code"
The debug takes me back to:
Forms![TRAUMA DATABASE].Filter = stfilter
I tried searching from the [TRAUMA DATABASE] form with a textbox with the following VBA:
Private Sub Name_Search_AfterUpdate()
Dim stfilter As String
stfilter = stfilter & "([Name] Like ""*" & Me.Name_Search & "*"")"
Me.Form.Filter = stfilter
Me.Form.FilterOn = True
End Sub
This works fine so i guess i must just have the wrong syntax at
Forms![TRAUMA DATABASE].Filter = stfilter
I've tried to solve it myself, ive read hours and hours of forums but now im admitting defeat
Do i have to make one form a subform of the other?
I know i could use queries etc but that seems to be overcomplicating something that should be very simple...
Last edited: