473,789 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a Textbox Control that will Cross Reference a Table

MitchR
65 New Member
Hi All;
I have a form that contains a textbox control called CPUServicetag (Serial number). My users enter in the CPUServicetag manually. My question is this ... How do I go about creating an expression in a separate textbox control with in the control source that would cross reference the manually entered CPUServicetag to a Table called RMA which contains two fields: Serial_num (CPUServicetag) and RMA# , and display in this separate textbox control the RMA# associated to the CPUServicetag which is the same as Serial_num. This is something I have never dealt with before and need some assistance
Jan 11 '07 #1
16 3211
NeoPa
32,579 Recognized Expert Moderator MVP
You can use the DLookup() function. Give me a short while and I'll knock up some (non-specific) VBA code to put in your form. If you were to come back with the correct name of the controls on your form where the data will be shown and the types of the two fields used, then I could tailor it more precisely.

NB. Access doesn't like using a '#' char in a control name - it will be converted automatically in related event names.
Jan 12 '07 #2
NeoPa
32,579 Recognized Expert Moderator MVP
Hi All;
I have a form that contains a textbox control called CPUServicetag (Serial number). My users enter in the CPUServicetag manually. My question is this ... How do I go about creating an expression in a separate textbox control with in the control source that would cross reference the manually entered CPUServicetag to a Table called RMA which contains two fields: Serial_num (CPUServicetag) and RMA# , and display in this separate textbox control the RMA# associated to the CPUServicetag which is the same as Serial_num. This is something I have never dealt with before and need some assistance
I've assumed you will change your [RMA#] field name to simply [RMA], and, for now, have assumed that the Serial_num field is alpha-numeric.
Expand|Select|Wrap|Line Numbers
  1. Private Sub CPUServicetag_AfterUpdate()
  2.     Dim strRMA As String
  3.  
  4.     If Me!CPUServicetag > "" Then
  5.         strRMA = "='" & DLookup("RMA", "RMA", _
  6.                                 "Serial_num='" & Me!CPUServicetag & "'") & "'"
  7.     Else
  8.         strRMA = ""
  9.     End If
  10.     Me!RMA.ControlSource = strRMA
  11. End Sub
Jan 12 '07 #3
MitchR
65 New Member
Thank You!! ... Thank You!! ... Thank You!! .... This resolved my issue.....Also I took your advice and changed my column name from RMA# to RMA
Jan 16 '07 #4
NeoPa
32,579 Recognized Expert Moderator MVP
Happy to help Mitch :)
Jan 16 '07 #5
MitchR
65 New Member
If I wanted to pass the varRMA to a text box field"RMA" in my table"MonitorRe turn" : ? ? ? Would this be the correct method ?

Expand|Select|Wrap|Line Numbers
  1.  varRma = "RMA", "MonitorReturn"
Jan 21 '07 #6
NeoPa
32,579 Recognized Expert Moderator MVP
I'm afraid not.
I get that you have a table=[MonitorReturn], but tables don't have TextBox fields. Are you talking about a form perhaps? And which way are you moving the data - your example looks as if you want to set varRMS (a VBA variable) from somewhere else rather move its value into your TextBox.
Jan 21 '07 #7
MitchR
65 New Member
I want to pass the RMA number that I was able to ascertain from the code we discussed earlier in this thread and deposit the RMA number in to a RMA column in the table MonitorReturn. I can make the RMA number appear in my Form Text Box "RMA" now I want to record it in my table.
Jan 21 '07 #8
NeoPa
32,579 Recognized Expert Moderator MVP
Sorry, I just read the last post quickly. I was rushing to catch up with all the updated threads since my last visit.
What you need is for the control (RMA) on your form to be bound to the underlying table. I assume the form is bound to the MonitorReturn table?
Jan 21 '07 #9
MitchR
65 New Member
Yes you are correct sir ! The Form is bound to the table ... I need the RMA result to deposit the RMA result into the table in a column(RMA) in Table (MonitorReturn)
Jan 22 '07 #10

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

Similar topics

6
565
by: Bhavin | last post by:
Anybody quickly replies it, would be a great help! I try to create dynamic array of textboxes control in ASP.NET(C#). I got the following error while I tried to assign value to ID property of dynamically created textbox. (look at my code please ) Error: “ Object reference is not set to an instance of Object” totalRows – int variable which varies with number of records in SQL table
0
5083
by: Max | last post by:
Suppose we have an object hierarchy in XSD. For example, let us take Control, Label, TextBox and LinkLabel windows controls. Each control has some properties which are represented as elements. Some of the elements are of complex types as well, like bounds - of type rectangle. (See full example in the bottom of the letter.) DataSet.ReadXMLSchema fails to parse such XSD file. The problem is caused by complex type as an element of the...
3
3947
by: Omar Llanos | last post by:
I have Form1 and Form2 (which is inherited from Form1), and I created a button in Form2 that will fill up a textbox in Form1. What code would do that? I tried the simplest way: //from child form in button2 clicked event: textbox1.Text = "Hello";
4
24765
by: Andy | last post by:
I am attempting to print out a table using a repeater in which one field is updatable. Basically you would have a table of x number of rows and y number of columns. However: only one field in each row will be updatable. My thought was to build a repeater and then one of the <ItemTemplate> would be a textbox where the user can update the values in each. How would I go about in the code-behind to reference each textbox? My texbox...
3
2505
by: John Mason | last post by:
Hi, I am trying to work out how to make reference to an asp textbox control within a class, contained in a user control, but receive the following error... BC30469: Reference to a non-shared member requires an object reference. Here is the code...
12
3175
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without restarting the application. What I did was to create an AppDomain that loaded the plugins and everything was great, until I tried to pass something else that strings between the domains...
17
46565
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction: The goal of this tutorial is to design a Data Abstraction Layer (DAL) in PHP, that will allow us to ignore the intricacies of MySQL and focus our attention on our Application Layer and Business Logic. Hopefully, by the end of this guide, you will...
0
1114
by: james.beauchamp | last post by:
Hi I'm trying to create a control with multiple regions that can be edited - maybe as templates I guess. I've seen a control that was done by Scott Mitchell which has rounded corners surrounding the control - here is a link to the page http://aspnet.4guysfromrolla.com/articles/081104-1.aspx) and this essentially has one editable region that will then be surrounded by the borders.
0
9656
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9499
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
10374
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...
1
10127
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,...
1
7519
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
5405
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...
0
5540
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
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.