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

Access 2000 - Carry a number through to another form

100+
P: 116
All

I am using Access 2000

I have created a list of records. When I double click the job number field it opens a new form.

The code i use is this.

Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String
  2. Dim stLinkCriteria As String
  3.  
  4. stDocName = "frm_adjust_magazine_overs"
  5. DoCmd.OpenForm stDocName, , , stLinkCriteria
I then retype that job number into the job number field on that new form and enter some figures.

Ideally what I would like to do is to double click on the job number and that same number copy into the newly opened form so I can then add my figures.

Thanks
Jacc14
Aug 13 '08 #1
Share this Question
Share on Google+
9 Replies


P: 50
Very simple.

Create a new module.

enter the following:
Option Compare Database
Option Explicit

Public gn_YourNumber as double 'this is a global variable

Now go to the first form. Now make gn_YourNumber equal to the number you are trying to pass.

Now on the second form, you load the text box with your global variable in form load sub.

That's all there is.


Ramon
Aug 13 '08 #2

100+
P: 116
Hi Ramon

Thanks for the advice, and so prompt. I have created the module but unfortunately am not an expert on this so not sure how to do the next bits.

"Now go to the first form. Now make gn_YourNumber equal to the number you are trying to pass.

Now on the second form, you load the text box with your global variable in form load sub."


On the second form I have put the following.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Me.OrderNo.Value = gn_Number 
End Sub

Hope you can help

Thanks
Jacc14
Aug 14 '08 #3

100+
P: 167
On your First form go to OnDouble_click event of the JobNumber control.
Put in a code like:
Expand|Select|Wrap|Line Numbers
  1. gn_YourNumber = Me!JobNumber
..and keep in place the rest of your original code that is allready there :-)
Aug 14 '08 #4

mshmyob
Expert 100+
P: 903
I personally would just use the OpenArgs parameter when you do your Docmd.openform.

Then in the Open event of the second form that you open you pick up the passed argument.

No need for modules.

cheers,
Aug 14 '08 #5

mshmyob
Expert 100+
P: 903
As an ammendment if it is a true number field use the CStr and Val function.
Aug 14 '08 #6

NeoPa
Expert Mod 15k+
P: 31,661
Are you clear on that now Jacc?

If not I'm sure we can answer any questions you still have.
Aug 15 '08 #7

100+
P: 116
thanks for this.

Just got back from a 2 week break so will have another go.

Cheers
jacc14
Aug 29 '08 #8

100+
P: 116
Hi

Thanks all for your help. RESULT :)

Best regards

Jacc14
Sep 1 '08 #9

NeoPa
Expert Mod 15k+
P: 31,661
Good to hear that helped :)
Sep 1 '08 #10

Post your reply

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