By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,155 Members | 2,518 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,155 IT Pros & Developers. It's quick & easy.

search form that passes a number

P: 80
Ok, I have a form that you can put in an order number and filter by it and see everything you need to see. But what Im trying to do is put in a customer number and hit a search button and have that bring up another form, or query and from there i could see the customer number, what order numbers they have and what consists of that order, with the order number as a hyperlink so when they click on it the order number will pass into the origional form and then i can search by the order number and get what I need.

any help is greatly appreciated, thanks in advance
Aug 9 '07 #1
Share this Question
Share on Google+
9 Replies


Rabbit
Expert Mod 10K+
P: 12,383
Ok, I have a form that you can put in an order number and filter by it and see everything you need to see. But what Im trying to do is put in a customer number and hit a search button and have that bring up another form, or query and from there i could see the customer number, what order numbers they have and what consists of that order, with the order number as a hyperlink so when they click on it the order number will pass into the origional form and then i can search by the order number and get what I need.

any help is greatly appreciated, thanks in advance
So what have you tried so far? Where are you getting stuck?
Aug 9 '07 #2

P: 80
Well so far I have a button that opens a query that has the order numbers and customer id numbers. I just can't seem to find away to have to get the order number back to the origional form, without copying and pasting. Is it even possible?
Aug 9 '07 #3

Rabbit
Expert Mod 10K+
P: 12,383
Well so far I have a button that opens a query that has the order numbers and customer id numbers. I just can't seem to find away to have to get the order number back to the origional form, without copying and pasting. Is it even possible?
Definitely possible.

But how you do it depends on what you're trying to do. So this second form is open, and they click one of the order numbers. What do you want to happen once they click it?
Aug 9 '07 #4

P: 80
Ok, Basically what I'd like to achieve here is you enter a Customer ID number on the main form and click a button that brings up a querry with all the order numbers that customer has. Then on the querry you could like click the order number and have that brought back into the main form where it can be filterd and you can see the details of the order. The reason I'm thinking querry is it would be easier to see all the order numbers that a customer has, whereas if you have a form you have to navigate through alll the records. Unless you could make it like a subform where it would just bring back the records in a list kinda deal, and I wana picture either a button to the side of every row that you could click, or the individual order numbers themselvs bieng "links".

I'm not sure if that makes any sence or not
Aug 9 '07 #5

Rabbit
Expert Mod 10K+
P: 12,383
Ok, Basically what I'd like to achieve here is you enter a Customer ID number on the main form and click a button that brings up a querry with all the order numbers that customer has. Then on the querry you could like click the order number and have that brought back into the main form where it can be filterd and you can see the details of the order. The reason I'm thinking querry is it would be easier to see all the order numbers that a customer has, whereas if you have a form you have to navigate through alll the records. Unless you could make it like a subform where it would just bring back the records in a list kinda deal, and I wana picture either a button to the side of every row that you could click, or the individual order numbers themselvs bieng "links".

I'm not sure if that makes any sence or not
Ok, so assuming that your main form has a textbox for CustomerID and one for OrderNumber. You fill in a CustomerID and hit a button. This opens another form that is continuous and lists all OrderNumbers with that CustomerID.

On this other form, you click an OrderNumber and it puts that number into the OrderNumber textbox of the main form.

So what you'll have in the code of the second form is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OrderNumber_Click()
  2.    Forms!FormName!OrderNumber = Me.OrderNumber
  3.    DoCmd.Close
  4. Ens Sub
  5.  
There are different ways of doing this with different setups.
Aug 9 '07 #6

P: 80
Ok, yea I didn't know what a continous form was :) So this is turning out to be alot easier that I thought.

Now what I have going on is the Order Number text field in my first form is txtOrderNumber and the name of the first form is OrderForm. On The second(continuous) form I put a button next to the row, and named the button btnInput and named the order info textbox Order Number.

So If im understanding your code, it should look something like

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnInput_Click
  2.       Forms![Order Number]![txtOrderNumber] = Me.[Order Number]
  3.       DoCmd.Close
  4. End Sub
  5.  
Because I tried that and nothing happens, the form doesn't eaven close. I'm using access 97 incase it matters.

Thanks for the help rabbit.
Aug 9 '07 #7

P: 80
Ohhhhhh never mind, I had the button name typed wrong, sigh. But everything is good now.

Now I'm wondering if there is a way to have it automatically update the rest of the main form when I transfer the number over. Or do I have to set the update for the form to after update on the textbox, instead on onClick on the button?
Aug 9 '07 #8

Rabbit
Expert Mod 10K+
P: 12,383
Ohhhhhh never mind, I had the button name typed wrong, sigh. But everything is good now.

Now I'm wondering if there is a way to have it automatically update the rest of the main form when I transfer the number over. Or do I have to set the update for the form to after update on the textbox, instead on onClick on the button?
I'm lost. What do you mean by update the rest of the main form?
Also, which button are you talking about? Which text box are you talking about?
Aug 9 '07 #9

P: 80
When I was typing the code in I spelt the name of it wrong. i did:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnInpu_Click
  2.  
On the main form I have a text box that I type an order number into and then hit a button that filters the records, and the record that matches goes into text boxes on my main form.

With this other form I hit the button and it takes the order number and inputs the number into my text field where I would enter the order number. What I was wondering is when I hit the button on the other form and the order number is passed to the main form, is there a piece of code that will update the filter, or do I just have to click the button to filter. Not that its a big deal, but it would be cool.
Aug 10 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.