G
Guest
I asked the qustion of how to make a text box searchable and I received the
response below. The only thing is when I search for an ID number, thats all
it brings up (It brings up a blank record with that ID number on it, there
are like 10 other fields, and I want all the information from the record to
show when I search). Is there a way to pull all the information by entering
the ID number? Is there something to add to this code to make it pull all
the information.
The way my database is set up is that I have 2 different forms, one form
(ID) is only used to add an ID number, the other form (Distribution List) is
used to add personel information to the ID number. Is there a way I can code
it so when I enter an ID number to the ID form, if that record already exists
it will automatically take me to that record in the Distribution List form,
and if that record does not exist it will take me to a new record with that
ID number? Is there any other way I might be able to accomplish this? You
need two controls for [ID]. Put one in the form header named IDFilter and
make it unbound (no ControlSource). Put the other one in the detail section,
bind it to the [ID] field and make it hidden.
In the AfterUpdate event of IDFilter have code...
Me.ID.DefaultValue = Chr(34) & Me.IDFilter & Chr(34)
Me.Filter = "[ID] = " & Me.IDFilter
Me.FilterOn = True
The way this works is the user enters the desired ID in the IDFilter control
and presses <Tab> or <Enter>. A filter is applied to show the record having
an ID value that matches their entry. If there is one found it will be
displayed. If there is not the form will display the blank (new record)
position and since the default value property has been set to the searched
for value any new record entered will have that value.
response below. The only thing is when I search for an ID number, thats all
it brings up (It brings up a blank record with that ID number on it, there
are like 10 other fields, and I want all the information from the record to
show when I search). Is there a way to pull all the information by entering
the ID number? Is there something to add to this code to make it pull all
the information.
The way my database is set up is that I have 2 different forms, one form
(ID) is only used to add an ID number, the other form (Distribution List) is
used to add personel information to the ID number. Is there a way I can code
it so when I enter an ID number to the ID form, if that record already exists
it will automatically take me to that record in the Distribution List form,
and if that record does not exist it will take me to a new record with that
ID number? Is there any other way I might be able to accomplish this? You
need two controls for [ID]. Put one in the form header named IDFilter and
make it unbound (no ControlSource). Put the other one in the detail section,
bind it to the [ID] field and make it hidden.
In the AfterUpdate event of IDFilter have code...
Me.ID.DefaultValue = Chr(34) & Me.IDFilter & Chr(34)
Me.Filter = "[ID] = " & Me.IDFilter
Me.FilterOn = True
The way this works is the user enters the desired ID in the IDFilter control
and presses <Tab> or <Enter>. A filter is applied to show the record having
an ID value that matches their entry. If there is one found it will be
displayed. If there is not the form will display the blank (new record)
position and since the default value property has been set to the searched
for value any new record entered will have that value.