Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Entry 3

Status
Not open for further replies.

xhuck28x

IS-IT--Management
Nov 25, 2003
12
US
I have a table name "tblPOOrderList" that includes a field named "PONumber." I am trying to design a form that will allow data entry. My problem is that the field "PONumber" will contain the same data for each record. Each record is unique by an autonumber "ID".

How do I have this automatically have the "PONumber" entered without having to retype it each time?

I ultimately want the user to enter the "PONumber" from a form, and then a new form will simply ask for the other fields but automatically insert "PONumber" based on entry of the previous form.

peace.
 
You could set the default value of the PO Number field to be the value that you desire.

 
There are much different ways to do this.
One way is to set up a global variable and use it when needed.
Another way is to capture the value from the first form every time you insert a new record (this way only work if the first form remains open).
You can also capture the value from the previous record.

Tell me which way you would like to go and I way help you out which the code.

I recommend using the global variable.
 
The best way to do this in a Main Form/Sub Form fashion. The Main Form would be a form tied to a table with the PONumber in it. Then you would need a subform that would be linked to the main form by the PONumber. On the subform you would have the Add New button. What will result is when you click Add New on the subform you will create a new record and the PONumber would already appear in the appropriate field. So in total you would have to make sure that your table design supports this also. Look at having a table called Purchase Orders that will have the PONumber as the Primary key and then perhaps a table called Purchase Order Details with PONumber as the Foreign Key. Link the PONumbers together from Primary to Foreign. The Main Form would be tied to just the Purchase Orders table and the Subform would be tied to Purchase Order Details. Ohh and I am sorry if I baby stepped you through it, force of habit from working with the technically challenged. Any questions just holla back at me.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
i want to capture the value from the first form (can this be done using a msg box from the second form?)

either way, I just want the user to be prompted for a PO, then from there they can enter the order information but the PONumber field is automatically populated.

 
OHH thats easy enough. In the Form_Load and On_Current event just code something similar to this:

Code:
Me![PONumber] = Forms![FormWherethePONumberisOriginally]![PONumber]

Try that and let me know how it works.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
Now that code I just mentioned will work as long as the form with the original PONumber is open. You might want to look at creating a button that opens the second form so that it will load to that PONumber that is present on the open form.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
docmeizie

I think that way will slow thing down a little.
Access have to check and see if the form exist
Then it has to check to see if this form is open
Then it has to find the textbox and get the value
And only then will it return the value to the desire field.

If xhuck28x knows how the work with variables I think that will be his best bet for the best performance.
 
nice95gle,

please post method using global variable.

 
In the
Code:
Declaration
section of any module setup your variable Like this:

Code:
Global gPONumber  As integer

Note: if you place this in a form it'll only be good for that form. So I recommend creating a new module called mdlGlobal and put all your global variables there.

Now go to your form that has your PO Numbers and on the botton that will open the next form type this before the code you are using to open up that second form.

Code:
GPOnumber=Me![Your Textbox/ or your combobox]



Note:[Your textbox/ or your combobox] should be the control that has the PO number you want to use in it.

Now on the second form in
Code:
onCurrent
type

Code:
‘this will check to see if this is a new record and if it is the PO number will be inserted into the field of your choice.
Code:
If Me.Form.NewRecord = True Then
	Me![Your textbox]=gPONumber
End If
Note: Now any time you create a new record it will paste the PO number from the first form

If you have any questions email me:
Curlanlj@yahoo.com
 
awesome!!!!! Great stuff works just the way I needed. How do I get it to load the second form with only a new record being displayed?

Right now it displays all records in the table...i want it to start with a new record.

peace.
 
sorry I took as long to get back to you. I'm sure you found the answer by now, but if you didn't.
Code:
DoCmd.OpenForm "YOUR FORM NAME", , , , acFormAdd
 
thanx for the help...i did find an alternative method to the one you recently posted...but the global variable works out great. simple technique, but very powerful. (hope that doesn't give away that i'm not a programmer).

peace.
 
you have my email address anytime you need help feel free to contact me.
[santa]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top