473,725 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to lookup the last field name in a MS Access table on a form?

4 New Member
I have a table as below in test.mdb Access database. on a form, I want to use lookup to capture the the last field name in a text on the form, in this case, it is 200906.
by using some code I searched on the web site, I only can see all the field names, How can I just capture the last field name in the crosstab query.

Thanks, SunnyC
Expand|Select|Wrap|Line Numbers
  1. LocationNo  Customer No  Status  20090101  20090201  20090301  20090401  20090501  20090601
  2. 34             1018      Active         1         1         1                             1
  3. 28             1038      Active        84        41        39        31        15
  4. 21             1035      Active        14        11         6         3         1
Jun 16 '09
14 11913
yarbrough40
320 Contributor
Ah Ha! I just re-read your question.... I think you want the last Column Name in your query am I right? again - I don't know the name of your crosstab query but substitute that name in for "MyCrosstabQuer yName" below......here is your code then: You can call the name this way... ENJOY!
Expand|Select|Wrap|Line Numbers
  1. Dim Con As ADODB.Connection
  2. Set Con = CurrentProject.Connection
  3. Dim rs As New ADODB.Recordset
  4. Dim sql As String
  5. sql = "select * from MyCrosstabQueryName""
  6. With rs
  7. .ActiveConnection = Con
  8. .Open (sql)
  9. End With
  10.  
  11. TextBox1.Value = rs.Fields(rs.Fields.Count-1).Name
  12.  
  13. End Sub
Jun 21 '09 #11
NeoPa
32,569 Recognized Expert Moderator MVP
Hi Yarbrough,

Welcome to Bytes!

4 posts and already contributing. Nice.

I would just draw your attention to the rules about using the [ CODE ] tags. I look forward to seeing more of you.

NB. Tags are done as matching pairs where the opening one is surrounded by [...] and the closing one by [/...]. A set of buttons is available for ease of use in the Standard Editor (Not the Basic Editor). The one for the [ CODE ] tags has a hash (#) on it. You can choose which editor to use in your profile options (Look near the bottom of the page).

PS. Is your name in any way related to the card game Bridge?
Jun 22 '09 #12
yarbrough40
320 Contributor
Thanks! this is a great forum... I've been searching it for months and getting great info from past questions...
I must be an idiot because I can't seem to see the Standard Editor options in my browser. anyway.. are you saying to simply type
[...]
then write some code
[/...]
then done?

btw.. my parents were bridge players and so I know about the bridge hand : ) I wish it were a name for one of the good hands...
Jun 22 '09 #13
NeoPa
32,569 Recognized Expert Moderator MVP
I'm very pleased you like it here. I'm looking forward to more interaction. You sound like you have some experience to offer :)

Did you click on the link I provided? It should take you directly to the page where those profile options are updated.

Lord Yarborough (Earl of Yarborough) was the sorry chap who never seemed to get any points (or maybe he was just pointless - who knows). If you feel you'd like your account name changed to reflect the spelling, please let me know.
Jun 22 '09 #14
yarbrough40
320 Contributor
Expand|Select|Wrap|Line Numbers
  1.  
  2. here's try number 2
  3.  
  4. hopefully this formats the code
  5.  
  6. Thanks for the link - the Earl was quite the man I guess!
  7.  
  8. End Sub
  9.  
  10.  
Jun 22 '09 #15

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

Similar topics

3
2916
by: my-wings | last post by:
I've been reading about how evil Lookup fields in tables are, but I've got to be missing something really basic. I know this subject has been covered before, because I've just spent an hour or two reading about it on google, but there is something I still don't understand, and I'm hoping someone will be willing to explain it to me in small words. Let's say I have a table for addresses, and it includes a field for state. What I would...
1
3361
by: Zachary Turner | last post by:
I want to make a Lookup Field based on another Lookup field. In other words, I have this table A with two fields: ID and Name, where ID is an Autonumber and Name is a friendly name. Then I have a table B which links to A via a Lookup Field so that I can select the friendly name from combo box. Now, I want to have a table C which links to table B via a lookup field, and only displays the items which are selected in some combo box of some...
13
2533
by: John Baker | last post by:
Hi: I have a general question about table access and look ups. Over simplifying things,and using a very theoretical example, lets say I have two tables; Client and Bill. The client table has a unique auto number (which is indexed) and the Client name, as well as address and other key data
3
10656
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems that are hard to find. The main problem I am having right now is that I have a report that is sorted by one of these lookup fields and it only displays the record's ID number. When I add the source table to the query it makes several records...
2
7985
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What I've done for test purposes is use a text input file for the table field lookup properties. I thought that I'd start first by just changing the 'Display Control' property. Thanks to Allen Browne for some ideals per...
3
2379
by: dancole42 | last post by:
I'm self-taught in Access, and as such I'm missing large chunks of knowledge, so I'm hoping someone here with some training can help me. Right now I have an Invoice form with a Customer subform. Right now it's set up so that someone can enter a customer ID, say, 12345, into the invoice form and customer 12345's name, address, etc. shows up in the Customer subform. How do I create a system where a user could start a new invoice, then
2
2110
by: ApexData | last post by:
How do I use a combo-box to do a lookup on my name table “T-NAME”, and then place the values found in the lookup table (ie LNAME, FNAME, MI) into to a row in my existing continuous forms table "T-SICK" ? I will have the combo-box lookup available in each row of my continuous form bound to "T-SICK" to make this happen. Thanks
14
6557
by: Mark | last post by:
I have a table with a field that uses a combobox to populate values. The Lookup tab within table design mode is the following: Display Control Combo Box Row Source Type Table/Query Row Source SELECT .LastName, .FirstName, .EmployeeNumber FROM ; Bound Column 3 Column Count 3 Column Heads Yes Column Widths 1";1";1"
6
5182
by: David Wright | last post by:
Hello Folks I am using Microsoft Access 2000 I would be grateful if someone could help me with “Dlookup”. I tried various methods of writing Dlookup and various events to trigger it, none of which were successful. I have been able to display the required value in a ‘text box’ which is a little helpful but not ideal. I have a table called tblLogSheet. The ‘Description’ field of this table uses a lookup table called...
0
8752
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
9257
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
9176
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
9113
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
6702
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
4519
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
3221
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
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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.