Show what I searched from Form A to Form B

hardhitter06

Registered User.
Local time
Today, 18:14
Joined
Dec 21, 2006
Messages
600
Hey Everyone,

Access 2003.

I have a form "frmFedIDSearch" where I enter in a 9 digit Fed ID and hit a search button to open "frmSearchMain" to retreive a record with that given Fed ID.

At times, the Fed ID will not be in the system so I'd like to show what the user searched on the second form so they can look over the number and make sure they entered it correctly.

Now I've done this before with a Date Range showing the range of the dates searched on the previous form (in other words what I searched on Form A is displayed on Form B)

With my current problem, on Form A I have a unbound textbox "text26" where you enter the Fed ID to be searched.

On Form B, I have an unbound textbox "text21" where I'd like to show the searched FedID.

With my date example, I used similar coding:

Code:
Private Sub Text21_BeforeUpdate(Cancel As Integer)
Forms!frmFedIDSearch.YourTextBoxNameHere = Me.Text26
End Sub

I'm not sure why "yourTextBoxNameHere" is in my code, but it worked for my old example so I just copied it over and make the appropriate Text box name changes.

Can someone let me know what I'm missing here??

P.S..I've tried this unbound textbox on both the Header and in the body of the form B to no avail.

Thank you.
 
I am beleiving that some one gave you an example and as such they used the phrase YourTextBoxNameHere to indicate the field on your form. You need to replace this with the Actual name of the textbox.
 
No dice.

Here is my code:
Code:
Private Sub Text21_BeforeUpdate(Cancel As Integer)
Forms!frmFedIDSearch.Text26 = Me.Text26
End Sub

I'm going to attach my database...I think it might be easier to look at then explain and troubleshoot if you don't mind.

Upon opening the dashboard --> Click Fed ID Search

Enter a Fed ID (I have 123456789 and 987654321 in the DB currently, but I'd like to show regardless if it is or isnt in the DB)

And Text21 is the textbox with the code behind it.

Thank You!
 

Attachments

You've only got one table in your database and you're trying to search on a field that isn't Indexed. Therein lies your problem.

If you still want to go ahead with the way you're doing it then look into the LIKE operator and IIF function.
 
I may be missing something but this is just an unbound textbox where a user will enter in a 9 digit Fed ID and then click a command button to run the search and open Form B.

I also looked at my table and my fields are indexed...but again I don't see the connection.
 
Ah yes it is. I only presumed since it's just a flat file structure it wasn't indexed. The connection is you perform LIKE searches on Indexed fields for maximum effeciency.

Can you db not be further normalized?

Let me get this straight, you want to show results whether or not there is a match?
 
No.

All I want to do is show what I searched for: i.e. what fed ID i inputted in the unbound textbx of Form A.

I want to display this on Form B.

So text26 of Form A is shown in text21 on Form B
 
I didn't think you were asking for that because you had written code in your db so I thought you would know how, at least you've got a good reference link now.

You're welcome. Good luck.
 

Users who are viewing this thread

Back
Top Bottom