473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Asset Upgrade Form

Craash
18
Hello, I am fairly new to creating databases with access.
I am using Access 2003 and have created an Asset tracking database.
I have a form to enter the asset information with the primary key as the asset ID#, on this form I would like to add a button to open an upgrade form. On the upgrade form I would like to have the Asset ID# field automatically filled in with the one on the form that the button resides. Any ideas? I think that this probably easier than I am making it. Any help would be greatly appreciated.

Thanks,
Cr@sh
Jan 27 '07 #1
11 2285
ADezii
8,834 Expert 8TB
Hello, I am fairly new to creating databases with access.
I am using Access 2003 and have created an Asset tracking database.
I have a form to enter the asset information with the primary key as the asset ID#, on this form I would like to add a button to open an upgrade form. On the upgrade form I would like to have the Asset ID# field automatically filled in with the one on the form that the button resides. Any ideas? I think that this probably easier than I am making it. Any help would be greatly appreciated.

Thanks,
Cr@sh
Assuming the Form with the button is called frmTracking, and the Text Box containing the ID to carry over is txtAssetID, and the Text Box on the Upgrade Form is also called txtAssetID, then to open the 2nd Form and carry over the Asset ID from the 1st Form:

Expand|Select|Wrap|Line Numbers
  1. 'In the Click() Event of the button on frmTracking
  2. Dim stDocName As String
  3. Dim stLinkCriteria As String
  4.  
  5. stDocName = "frmUpgrade"
  6. DoCmd.OpenForm stDocName, , , stLinkCriteria
Expand|Select|Wrap|Line Numbers
  1. 'In the Open() Event of the 2nd Form
  2. Private Sub Form_Open(Cancel As Integer)
  3.   Me![txtAssetID] = Forms![frmTracking]![txtAssetID]
  4. End Sub
Jan 27 '07 #2
Craash
18
Assuming the Form with the button is called frmTracking, and the Text Box containing the ID to carry over is txtAssetID, and the Text Box on the Upgrade Form is also called txtAssetID, then to open the 2nd Form and carry over the Asset ID from the 1st Form:

Expand|Select|Wrap|Line Numbers
  1. 'In the Click() Event of the button on frmTracking
  2. Dim stDocName As String
  3. Dim stLinkCriteria As String
  4.  
  5. stDocName = "frmUpgrade"
  6. DoCmd.OpenForm stDocName, , , stLinkCriteria
Expand|Select|Wrap|Line Numbers
  1. 'In the Open() Event of the 2nd Form
  2. Private Sub Form_Open(Cancel As Integer)
  3.   Me![txtAssetID] = Forms![frmTracking]![txtAssetID]
  4. End Sub

Thanks ADezii,

Needed the second part...worked great :)
Jan 27 '07 #3
Craash
18
My mistake ... this is actually giving a runtime error 2448
You can't assign a value to this object...The object is a text box the field in the table is a longinteger

This is producing the error...

Private Sub Form_Open(Cancel As Integer)
Me![AssetID] = Forms![frmAssetInfo]![AssetID]
End Sub

The field in the table is a long integer...Tried changing it to text and no help...
Jan 27 '07 #4
ADezii
8,834 Expert 8TB
My mistake ... this is actually giving a runtime error 2448
You can't assign a value to this object...The object is a text box the field in the table is a longinteger

This is producing the error...

Private Sub Form_Open(Cancel As Integer)
Me![AssetID] = Forms![frmAssetInfo]![AssetID]
End Sub

The field in the table is a long integer...Tried changing it to text and no help...
It shouldn't make a difference that the Field Data Type is Long Integer, verify your Form and Field names.
Jan 27 '07 #5
Craash
18
It shouldn't make a difference that the Field Data Type is Long Integer, verify your Form and Field names.
The Form and Field names are correct. I have changed the names to obvious wrong names to verify the error would be different and it is, so it is not the naming convention or wrong names within the code.
Thanks for the help
Jan 27 '07 #6
Craash
18
The Form and Field names are correct. I have changed the names to obvious wrong names to verify the error would be different and it is, so it is not the naming convention or wrong names within the code.
Thanks for the help
The problem seems to be because the AssetID textbox on the upgrade form is bound to the AssetID field in the tblAssetUpgrade. If I make the textbox unbound the code works fine but will not commit the value to the table.
Jan 27 '07 #7
missinglinq
3,532 Expert 2GB
Try this.
Expand|Select|Wrap|Line Numbers
  1. 'On the first form button OnClick
  2. DoCmd.OpenForm "Doctors", acNormal, , , acAdd, , Me.AssetID.Value
  3.  
Expand|Select|Wrap|Line Numbers
  1. 'In the code of the second form
  2. 'This allows the form to be opened from the first form OR opened independently 
  3. Private Sub Form_Load()
  4.    If Len(Nz(Me.OpenArgs, "")) > 0 And Me.NewRecord Then
  5.       Me.AssetID.Value = Me.OpenArgs
  6.    End If
  7. End Sub
  8.  
Jan 27 '07 #8
Craash
18
Try this.
Expand|Select|Wrap|Line Numbers
  1. 'On the first form button OnClick
  2. DoCmd.OpenForm "Doctors", acNormal, , , acAdd, , Me.AssetID.Value
  3.  
Expand|Select|Wrap|Line Numbers
  1. 'In the code of the second form
  2. 'This allows the form to be opened from the first form OR opened independently 
  3. Private Sub Form_Load()
  4.    If Len(Nz(Me.OpenArgs, "")) > 0 And Me.NewRecord Then
  5.       Me.AssetID.Value = Me.OpenArgs
  6.    End If
  7. End Sub
  8.  
Thanks missinglinq, worked great. I tested it several ways before replying...Thanks to both of you for your help
Jan 27 '07 #9
NeoPa
32,556 Expert Mod 16PB
'This allows the form to be opened from the first form OR opened independently
This is a very important point and good developers always allow for an operator opening a form independantly. Another reason (probably more likely) is that you, the developer, will come back at a later date and try to work out what an object (Form; QueryDef; Report; etc) is for and find that it won't work unless some other dependant form is also running and available.
Jan 27 '07 #10
Craash
18
This is a very important point and good developers always allow for an operator opening a form independantly. Another reason (probably more likely) is that you, the developer, will come back at a later date and try to work out what an object (Form; QueryDef; Report; etc) is for and find that it won't work unless some other dependant form is also running and available.

Thanks for the tips NeoPa...I can use all the advice I can get. I find this very frustrating and rewarding at the same time. :)
Jan 28 '07 #11
NeoPa
32,556 Expert Mod 16PB
Pleased to help - though it was really Linq that brought it up (Seems to bring up lots of good ideas :)).
The more you use it, the better you get at it and the less frustrating it gets.
Jan 28 '07 #12

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

Similar topics

8
by: Mike | last post by:
Hi! Im working on some research for a asset management system. We will use python as our primary platform. As a opensource programmer the obvious question is; are there any opensource systems...
2
by: Tappy Tibbons | last post by:
Have many of you upgraded to VS 2003? We have been using Visual Studio 2002, and are somewhat satisfied, except for the following areas: Speed - VS2002 apps are dead dog slow to start up, and...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
5
by: keith58 | last post by:
Hi I have started using a year old version VB.Net Standard Version 2003 recently. I purchase a "how to" book and noticed that the book had several extra object properties displayed in it's...
2
by: JHN | last post by:
Hi all, I'm planning on building an asset management tool for our local network. I have a question I would like to ask: Is it possible to use PHP/MYSQL/JS etc. as a "metadata" structure and...
2
by: KR | last post by:
Hi, We are running a test upgrade form sql 2000 standard edition to sql 2005 developer edition. Followed through all the steps and specified the account(SA priveleges and currently used by the...
6
by: ARC | last post by:
I'm almost ready to build an upgrade routine for a commercial app that will need to import data from an existing Access 97 back-end database to an Access 2007 back-end blank database. Ideally, it...
1
by: danka21819 | last post by:
Hi, I am a front end web designer/developer and analyst...struggling with putting an accordian flash xml menu together. I have it done except I need to add a simple trademark symbol circle with r. I...
1
by: danka21819 | last post by:
Hi, I am a front end web designer/developer and analyst...struggling with putting an accordian flash xml menu together. I have it done except I need to add a simple trademark symbol circle with r. I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.