473,836 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with error 2448: You can't assign value to this object

10 New Member
I need help with error 2448: You can't assign value to this object. What I am trying to do is allow user to select event id and race id from combo option. Once the user selects those, then the id associated with those is suppose to be carried over to a new form which should associated those two ids with runner id from runner table. Thus, I will have all three ids in event-race-runner table (which is an associative table). However when I do that I get the error message which does not let me insert the ids into this new table. I have attached the codes below. All id are number. The main table ids were generated automatically.

This is the code which should carry the ids:
Private Sub cmdAddRaceRunne r_Click()
DoCmd.OpenForm "Input Runner for race", , , , acFormAdd, , OpenArgs:=cmbEr Eventid & "|" & cmbErRaceid
end sub

this is the form which should have assigned the id into the new table:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     If Len(Me.OpenArgs & "") > 0 Then
  3.     Dim i As Integer
  4.     Dim s As String
  5.     Dim x As String
  6.     Dim y As Integer
  7.     Dim a As String
  8.     Dim b As Integer
  9.  
  10.     s = CStr(Me.OpenArgs)
  11.     i = InStr(1, s, "|")
  12.  
  13.     x = Left(s, i - 1)
  14.     y = CInt(x)
  15.     Me.txtAddRunnerEventid.SetFocus
  16.     Me.txtAddRunnerEventid.Text = y
  17.  
  18.     a = Mid(s, i + 1)
  19.     b = CInt(a)
  20.     Me.txtInputRunnerid.SetFocus
  21.     txtAddRunnerRaceid = b
  22.     End If
  23.  
  24. End Sub
  25.  
I have use extra variable because I thought I had to convert the text into integer before assigning. any help would be appreciated to solve the problem.
Apr 3 '10 #1
17 9623
patjones
931 Recognized Expert Contributor
Hi zombie -

Just as a note for future reference, please use code tags when posting VBA...

Can you indicate what line the error is happening on? You can do this by setting a breakpoint in the code and then stepping through it line by line using the F8 button, until the error gets triggered.

Looking at your code, I see one possibility for the error, but I'd like to confirm first that it's where Access is stopping before I point it out.

Pat
Apr 3 '10 #2
missinglinq
3,532 Recognized Expert Specialist
What exactly is the purporse of the "|" in your code?

Welcome to Bytes!

Linq ;0)>
Apr 3 '10 #3
RuralGuy
375 Recognized Expert Contributor
Here is a simpler way to do what you are doing. http://www.baldyweb.com/OpenArgs.htm
Apr 4 '10 #4
zombiezoom
10 New Member
@zepphead80
Thank you for your response. I am new to VBA and am not sure what exactly you mean by tags.

I get error when I try to assign values into text fields "Me.txtAddRunne rEventid.Text" and "txtAddRunnerRa ceid". The text fields are part of an associative table (event-race-runner table). What I am trying to do is assign the value that I extract from a prior form and insert into the event-race-runner associative table - thus inserting eventid and raceid. For some reason, access is not allowing me to input that values as it gives me error 2448: You can't assign value to this object. To get around the problem, I tried to use VBA instead of macro from in the previous form save button. But even in that I get error message saying that I am an error in the INSERT STATEMENT. The following is the SQL INSERT command I used:

CurrentDb.Execu te "INSERT INTO event-race-runner (eventid, raceid, runnerid) VALUES (txtAddRunnerEv entid, txtAddRunnerRac eid, txtAddRunnerRac eid)"

The above SQL command also includes a runnerid that is autogenerated.
Apr 4 '10 #5
zombiezoom
10 New Member
@RuralGuy
Thank you. This is definitely lot easier and I am using this instead of my old VBA code.
Apr 4 '10 #6
zombiezoom
10 New Member
@missinglinq
I use it to separate the arguments that I am passing from one form to another.
Apr 4 '10 #7
RuralGuy
375 Recognized Expert Contributor
You're welcome. Glad we could help.
Apr 4 '10 #8
zombiezoom
10 New Member
Hi RuralGuy,

I am still unable to solve the error message and I could really use some help. Here is additional explanation about my error:

I get error when I try to assign values into text fields "Me.txtAddRunne rEventid.Text" and "txtAddRunnerRa ceid". The text fields are part of an associative table (event-race-runner table). What I am trying to do is assign the value that I extract from a prior form and insert into the event-race-runner associative table - thus inserting eventid and raceid. For some reason, access is not allowing me to input that values as it gives me error 2448: You can't assign value to this object. To get around the problem, I tried to use VBA instead of macro from in the previous form save button. But even in that I get error message saying that I am an error in the INSERT STATEMENT. The following is the SQL INSERT command I used:

CurrentDb.Execu te "INSERT INTO event-race-runner (eventid, raceid, runnerid) VALUES (txtAddRunnerEv entid, txtAddRunnerRac eid, txtAddRunnerRac eid)"

The above SQL command also includes a runnerid that is autogenerated.
Apr 4 '10 #9
RuralGuy
375 Recognized Expert Contributor
To start with, controls have both a .Text property as well as a .Value property. The control needs to have the focus if you use the .Text property but not if you use the .Value property (the default). I mostly use the .Value property and Me.ControlName. Value and Me.ControlName both will use the .Value property.
Apr 4 '10 #10

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

Similar topics

2
23953
by: bradleyp | last post by:
Hi all, Hopefully somebody can help. In Access 2002-SP2, I receive an error from the VB Editor if I try to compile the following code (see below). The error is as follows: Compile Error: Method or data member not found The follow subroutine is highlighted (specifically .txtNR_Program1):
10
5730
by: MLH | last post by:
Anybody know why I might be getting error #2109 during the procedure below? It does not occur on 2 desktops, but did on a laptop. The error said: "The following unexpected error occurred in Sub OwnerZip_AfterUpdate, CBF on frmOwnerEntryFrm. 2109: "There is no field named 'OwnerCity' in the current record." Private Sub OwnerZip_AfterUpdate() On Error GoTo OwnerZip_AfterUpdateErr
23
3301
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application to create certain textboxes, labels, and combo boxes? Any ideas would be appreciated. Thanks
2
3778
by: Phillip Galey | last post by:
I have an object called Place which contains only string properties and has the <Serializable()> flag before the class name declaration. I also have a collection object called Places, which is implemented using Inherits System.Collections.Specialized.NameObjectCollectionBase and also has the <Serializable()> flag before the class name declaration. In the calling code, I'm successfully serializing the object to an XML file using a...
6
1599
by: Jean Christophe Avard | last post by:
Hi! I'm designing an application that produces invoices. I have a combobox that is populated with the Name of every client in the database. What I would like to do is to have the combobox to display the name, and to have the value set to the ID of the record... Like in HTML where you have something like: <option value="ID_NUMBER(primary key)">CLIENT_NAME</option> so, let's say the user selects "Client #2" in the combo box, then I would...
2
6241
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the problem. Any suggestings are welcomed. Jim ************* You tried to assign the Null value to a variable that is not a Variant data type. Description: An unhandled exception occurred during the execution of the current web request. Please...
8
1257
by: Bruno Alexandre | last post by:
Hi guys, I'm using a session to save an ArrayList, so I do not read Database everytime user reload the page or enter the site (the Data is consistent for all entire session time when the user is on the site). I'm using a Class called ProductBoxes and inside I have a public property of Object type and I call from the PageLoad event dim boxes as new ProductBoxes
0
5578
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
8
2562
Dököll
by: Dököll | last post by:
Hey gang! Below code allows me to search my database though all fields included on the form. Works great. Small issue, when I fetch partial phrases, if they contain an apostrophy, say, "Ferris Bueller's Day Off", Access does not understand it an gives me either ther 3075 error, or the other. What are your thoughts on that? Any information you have is appreciated.
0
10859
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10560
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10260
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4463
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.