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
11 2285
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: - 'In the Click() Event of the button on frmTracking
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "frmUpgrade"
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
- 'In the Open() Event of the 2nd Form
-
Private Sub Form_Open(Cancel As Integer)
-
Me![txtAssetID] = Forms![frmTracking]![txtAssetID]
-
End Sub
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: - 'In the Click() Event of the button on frmTracking
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "frmUpgrade"
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
- 'In the Open() Event of the 2nd Form
-
Private Sub Form_Open(Cancel As Integer)
-
Me![txtAssetID] = Forms![frmTracking]![txtAssetID]
-
End Sub
Thanks ADezii,
Needed the second part...worked great :)
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...
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.
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
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.
Try this. - 'On the first form button OnClick
-
DoCmd.OpenForm "Doctors", acNormal, , , acAdd, , Me.AssetID.Value
-
- 'In the code of the second form
-
'This allows the form to be opened from the first form OR opened independently
-
Private Sub Form_Load()
-
If Len(Nz(Me.OpenArgs, "")) > 0 And Me.NewRecord Then
-
Me.AssetID.Value = Me.OpenArgs
-
End If
-
End Sub
-
Try this. - 'On the first form button OnClick
-
DoCmd.OpenForm "Doctors", acNormal, , , acAdd, , Me.AssetID.Value
-
- 'In the code of the second form
-
'This allows the form to be opened from the first form OR opened independently
-
Private Sub Form_Load()
-
If Len(Nz(Me.OpenArgs, "")) > 0 And Me.NewRecord Then
-
Me.AssetID.Value = Me.OpenArgs
-
End If
-
End Sub
-
Thanks missinglinq, worked great. I tested it several ways before replying...Thanks to both of you for your help
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.
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. :)
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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
|
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...
| |