473,672 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing data from a specific field when clicking on another

44 New Member
Hello there!
I’m coping with this problem I haven’t been able to solve so far.
I have a subform, say sbfrm1. What I need is that whenever in sbfrm1 I click
any record within a specific field, say field2, Access could read the numerical value shown inside a string in the same record but in another field, say field1 and store this value in a variable called Var1.
For example. If I click the value shown in field2 record ID7 while field1 recordID 7 shows the string “ABC 125”I need the numerical value 125 to be stored in Var1.
I suppose an onclick event could be used but I haven’t the faintest idea on how I can get what I need.
Thank you in advance for any useful suggestions.
Oct 19 '18 #1
9 1418
NeoPa
32,569 Recognized Expert Moderator MVP
That sounds straightforward enough David, however your description doesn't make very clear what data you want from [Field1] if it isn't exactly in the format you've illustrated. Is it always in position #5 that the numeric data starts? Will there ever be non-numeric data after the numeric data starts? For now I'll assume there will always be the first space before the numeric data.

You also don't describe what Var1 is or what you expect do do with it. For simplicity here I'll assume it's a variable you've defined elsewhere in the code and has a scope that makes it accessible from the form's module.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Field2_Click()
  2.     Var1 = Val(Split(Me.Field1.Value, " ")(1))
  3. End Sub
This code would go in the Form's associated module. If you paste it into the module then [Field2]'s OnClick property will be set up for you automatically.

Good luck with your project :-)
Oct 19 '18 #2
David57
44 New Member
Hello NeoPa,
Thank you very much for replying.
ABC 125 was just an example.
The data I need to retrieve from Field1 is always the numeric one located at the end of a string of 3 possible types: FHP 177 or Z/FHP 125 or RCC/FHP 35 (the numbers can vary but the strings are the real one).
As you can see there always 1 space before the numeric data and no non-numeric data after.
The result I'm trying to obtain, NeoPa, is changing the font color and size of all records (usually just a few) showing in Field1 the numeric value stored in Var1.
David
Oct 20 '18 #3
David57
44 New Member
Hello NeoPa,
Wonder if adding a new field, say FieldNo, for the numeric value only, could make things any easier.
It still remains, however, the problem of changing the size and color of the records containing in Field1 the value stored in Var1, becouse this is the final result I am aiming to.
David
Oct 20 '18 #4
David57
44 New Member
Hello NeoPa,
In the last line of my previous post please read:
"containing in FieldNo the value stored in Var1"
Sorry for the mistake.
David
Oct 20 '18 #5
NeoPa
32,569 Recognized Expert Moderator MVP
That sounds like quite a different question David. One gives you a value from a Control after you click on another Control, the other changes Control properties based on the same value, but not triggered by clicking.

I suggest you give up on this one as the question's been asked and answered, and ask a separate one which more closely matches what you want. Other than the basic logic of extracting the number from the string the answer will be very different from this one.
Oct 20 '18 #6
David57
44 New Member
Hello NeoPa,
Thank you for your concerning in my problem.
Let us suppose I add one more field, say FieldNo, for numeric data only, then I can summarize the problem as follows (please refer to my first post).
Whenever I click any record within Field2, I want the value shown in the same record but in FieldNo
to be stored in Var1 in order to change the font size and color of any record in sbfrm1 that in fieldNo shows the value stored in Var1.
As a matter of fact the above actions are triggered by clicking any record within Field2.
I don’t know if this problem can be solved. Creating Var1 and adding FieldNo are just my idea for trying out a possible solution but maybe this is not the best choice. Sorry for my poor English.
David
Oct 22 '18 #7
NeoPa
32,569 Recognized Expert Moderator MVP
Hi David.

I expect your English is the problem with your not understanding my last post very clearly. I will say it again for you, but more clearly.

Your new question needs to be posted in a completely separate thread. That means you need to start a new thread and ask your question fully (so include all the details) and clearly. You are welcome to post in link to this current thread from your new one, but this one isn't very easy to follow so I would suggest starting from scratch completely may well be a better option for you.

This current thread will then stay as it is with an answer to the question you originally asked (even though it wasn't the question you intended to ask).

I'll look out for your new thread.
Oct 22 '18 #8
David57
44 New Member
Hi NeoPa,
I fully understand the point, now. I'll ask a different question in a new tread.
Thank you for helping.
David
Oct 23 '18 #9
NeoPa
32,569 Recognized Expert Moderator MVP
Always glad to help David :-)
Oct 23 '18 #10

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

Similar topics

6
7290
by: jochen scheire | last post by:
Is there a way I can calculate a field in a form based on another field in the same form. When clicking submit, both values should be posted to the next page. I want to be able to type in a value in one field, and automatically in a second field the value*1,36 should appear.
2
1359
by: JP SIngh | last post by:
Hi All I am writing an ASP application that deals with the TV tapes and two of the fields is what I am having issues with I need to store the duration of the program i.e. DURATION field only to accept Numerical entries in the form 000:00:00 (min:secs:frames) I also need to store the TIMECODE field only to accept Numerical entries in the form 00:00:00:00 (hours:mins: secs:frames)
0
2014
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
7
2232
by: jballard | last post by:
Hello, I have a database set-up with a form and two subforms in it. I have one of the subforms (replacement parts) set-up where you can pick part numbers from a drop down box and also pick a description of the part from a drop down box. These are two separate fields. I want to be able to pick the part number and have it put in the description automatically or the other way around. Which ever would by easier?
1
3544
by: meganrobertson22 | last post by:
hi everybody- what is the best way to add data from one form to another? i have 2 tables: person and contract. here are some of the fields. table: person personid (autonumber and primary key) ss#
5
2194
by: hfk0 | last post by:
Hi, I'm new to ASP.net, SQL Server and visual studio.net, and I'm having problem inserting and storing data from a web form to a SQL database. I created a simple ASP.NET web form, a simple SQL database, a database connection (using the SQlDataSource Web Control from the Toolbox), and created the following stored procedure in Visual Studio.Net 2005:
3
10353
by: mathewgk80 | last post by:
Hello, I would like to know how to pass values of a gridview to another page when clicking on the link field in a gridview. Please help me. regards, Mathew
3
3460
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were some method, similar to FIND RECORD (e.g., CTL + F ), where a dialog box would pop up and let me enter the field name, and then jump the cursor to that location. I currently do my edits by locating a record to be changed by ID using CTL+F and...
6
1849
by: Randoz | last post by:
I have a simple data base with items that need to be worked on. Each record has a unique number assigned as a priority. The numbers are 1-100 for example, in the order that they are to be worked on. I want to be able to change record 50 form 50th priority to another priority (manualy) say to priority 5 and then change all records previously 5-49 to 6-50 priority and allows for the new priority 5. Any help on how to do this would be greatly...
8
1380
by: billef32 | last post by:
I've made a database for my contacts. On the top of my main form (names) I put a combobox where the row source is : SELECT . , . , . FROM ORDER BY ; that will show me a list of ID name and last name of each record (each row of that list is a record). I want everytime that I click on a row of that list to focus on that record.
0
8502
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8418
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
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
8638
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
8696
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
6254
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...
1
2836
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
2089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1834
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.