473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Table Column source from LookUp function (Access 2007)

5
We have about 2 dozen security officers who patrol about 120 buildings. They find defective or unlocked doors and write a "Trouble Report" on the door. This card gets turned in, where I have designed an Access Field and Table to enter the information and store it. They then get emailed to their respective supervisors so the problems can be dealt with.

As of right now, we have a big list on the wall of the buildings and their supervisors. After entering the building abbreviation, we have to look on the wall for who it goes to, and enter that name into a text box. Then, once we have entered all the TR's for the night, we open up the table and mark the ones to be sent out (using a print query and checkbox). Next to that check box is the name of the person we entered, so we can see who to send it to. This probably isn't making any sense, so I'll try to cut to the chase:

I can easily set up a DLookUp function as a Text Box in the Form. This displays who the TR should get sent to. But I can't get it to record in the table. So, while I can see it in the form, that is no use to me. I need a DLookUp type function as a column in a Table.

So here's my question: how do I set a function to a table column? The idea is this:
If Row 1 Column 1 reads "A", I want Row 1, Column 2 to read "B"
If Row 2 Column 2 reads "C", I want Row 2, Column 2 to read "D"

Col 1 Col 2
A..........B
C..........D
E..........F
E..........F
C..........D
A..........B
E..........F
A..........B
C..........D
C..........D
E..........F

Where Col 1 is entered manually, and Col 2 is automatically entered using some kind of LookUp function.

I hope this hasn't confused anyone too much. Let me know if it needs more clarification.
Mar 29 '08 #1
8 6764
PianoMan64
374 Expert 256MB
We have about 2 dozen security officers who patrol about 120 buildings. They find defective or unlocked doors and write a "Trouble Report" on the door. This card gets turned in, where I have designed an Access Field and Table to enter the information and store it. They then get emailed to their respective supervisors so the problems can be dealt with.

As of right now, we have a big list on the wall of the buildings and their supervisors. After entering the building abbreviation, we have to look on the wall for who it goes to, and enter that name into a text box. Then, once we have entered all the TR's for the night, we open up the table and mark the ones to be sent out (using a print query and checkbox). Next to that check box is the name of the person we entered, so we can see who to send it to. This probably isn't making any sense, so I'll try to cut to the chase:

I can easily set up a DLookUp function as a Text Box in the Form. This displays who the TR should get sent to. But I can't get it to record in the table. So, while I can see it in the form, that is no use to me. I need a DLookUp type function as a column in a Table.

So here's my question: how do I set a function to a table column? The idea is this:
If Row 1 Column 1 reads "A", I want Row 1, Column 2 to read "B"
If Row 2 Column 2 reads "C", I want Row 2, Column 2 to read "D"

Col 1 Col 2
A..........B
C..........D
E..........F
E..........F
C..........D
A..........B
E..........F
A..........B
C..........D
C..........D
E..........F

Where Col 1 is entered manually, and Col 2 is automatically entered using some kind of LookUp function.

I hope this hasn't confused anyone too much. Let me know if it needs more clarification.
Instead of using the table to create what it is that you want, you simply create a query that will lookup the information for you and display that result in the report or whatever you're wanting to display.

Create a query with both the tables and link them by col1 with the cross reference list.

Hope that helps,

Joe P.
Mar 29 '08 #2
NeoPa
32,556 Expert Mod 16PB
It seems to me that you're simply selecting the next letter of the alphabet. Is this the case or is that an accident of your example?

Also, are you doing this in Access or Excel? your text refers to DLookUp() which is an Excel function, yet you also refer to tables.
Apr 3 '08 #3
missinglinq
3,532 Expert 2GB
First off,
...are you doing this in Access or Excel? your text refers to DLookUp() which is an Excel function, yet you also refer to tables.
Huh? HLookup() and even plain old LookUp() are Excel functions, but not DlookUp()!

Next,
I can easily set up a DLookUp function as a Text Box in the Form. This displays who the TR should get sent to. But I can't get it to record in the table. So, while I can see it in the form, that is no use to me. I need a DLookUp type function as a column in a Table.
When the content of a textbox isn't saved to a table, it's because the textbox is not bound to a field in the underlying table/query. In Design View for your form, if you select the Col2 textbox and go to Properties - Data what appears in the ControlSource property box?

If it's empty, use the down arrow and select the field in your table that you want to use to save the value for Col2.

If it's not empty, what's in there? Is it the DLookUp() function that you've referred to for finding the value of Col2? If this is so, you need to

  1. Move the DLookUp() function to the event named Col1Field_AfterUpdate() (replace Col1Field with your actual textbox name) and
  2. as outlined above, use the down arrow of the ControlSource property and select the field in your table that you want to use to save the value for Col2.
And finally, as to NeoPa's second question
It seems to me that you're simply selecting the next letter of the alphabet. Is this the case or is that an accident of your example?
If this is true, that you simply need to choose the next letter in line to populate Col2, you wouldn't need to use DLookUp() at all, but simply
Expand|Select|Wrap|Line Numbers
  1. Private Sub Col1Field_AfterUpdate()
  2.    If Me.Col1Field <> "Z" Then
  3.     Me.Col2Field = Chr(Asc(Me.Col1Field) + 1)
  4.    Else
  5.    'Do here whatever you want to do if Me.Col1Field = "Z"
  6.    End If
  7.   End Sub
Welcome to bytes!

Linq ;0)>
Apr 4 '08 #4
NeoPa
32,556 Expert Mod 16PB
First off,

Huh? HLookup() and even plain old LookUp() are Excel functions, but not DlookUp()!
...
You're absolutely right of course. I was getting confused :S
I was thinking of VLookup() :D
Apr 4 '08 #5
mguy27
5
I've been away from the office for about 2 weeks, and now that I'm back, I'm working a little bit on this ongoing problem.

Orignally I had tried the query thing, and couldn't get it to work. I've gone back to trying to work with the query, and here's my dilema(s):

As it stands, there are 2 fields in a form. The first (named simply: #) is the security guard's number. The second field is their last name (named: Officer). What I want to have happen is this: I type in the security officer's number (they range from 501 to 524) and up pops his last name in the next field. The two fields right now are just combo boxes and the row source is like this: "501";"502";"503"...etc.

So, I've made a query, but it seems to be too simple/1-sided. I have a table. In column 1 (labled OfcrNum) I have the numbers (501, 502, 503, etc.). In column 2 (labled OfcrNam), I have the corresponding last names (Johnson, Watts, Francis, etc.) When I build the simple query and select OfcrNam, all it returns is the list of their names in the order they are found in the table. So I put that query is as the record source for my combo box back in my form in the Row Source box under properties, and it gives me that list...but that's not what I want. I want some kind of "auto fill" that will put the corresponding name into the field Officer when his number is typed into the field #.

I hope that isn't too confusing. And earlier, I wasn't using actual letters. I was just using A, B, C, D, etc. as an example representation for corresponding officer numbers and names.


Later, I want to be able to do the same thing with building names and supervisors' names. Like I said earlier, these trouble reports are written for specific buildings, and need to go to their respective supervisors. I'd love to be able to type in the building name into textbox "Building" and have it auto fill with the corresponding supervisor into textbox "Super".

Any hints to such a simple problem would be great. Thanks so much for all your help!!

-Taylor
Apr 12 '08 #6
NeoPa
32,556 Expert Mod 16PB
If you create a ComboBox on your form with a query as the source returning the # & name from your table, you can hide the name column from your ComboBox then set the value of your name TextBox field from the results of your ComboBox in its AfterUpdate event procedure.

Does that sound like it may solve your problem?
Apr 14 '08 #7
mguy27
5
What kind of event would it be? like a DLookup? or another query?

I played around with an update query to try and put that in, but couldn't get it to iron out.I'm frustrated because this seems so simple, yet for whatever reason I am missing the "key" to bring it all together.
Apr 15 '08 #8
NeoPa
32,556 Expert Mod 16PB
The event is the AfterUpdate event. Does that make sense to you? If not we can go into more detail.
Apr 15 '08 #9

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

Similar topics

1
by: Eugene | last post by:
Hello All, I need a report in Access 2007 to show a dynamic image on every page. I have a table, and I store image's path in a cell in each of the rows. In 2003, I was able to do that using...
14
by: TimmyNZER | last post by:
Hi, I would like to be able to have a button on a form, that when clicked will add specific information from that form to a table. I would be greatful to anybody who can tell me how to do this! I...
2
by: patio | last post by:
MS Access 2007 Form. I need to create either check boxes or a mutivalued list in a form where the user can select more than one item. For example, I am creating a call list that tracks various...
7
by: ARC | last post by:
This is taken from the "What's New in Access 2007" page. However, I've looked through all the properties of a text field memo box, and cannot find the append only option. Does anyone know how to...
1
by: rickcross | last post by:
I am trying to use the Access 2007 runtime. I have a program that is fully working in 2007 but when I install the runtime version with same Operating system and Access 2003 installed I have...
2
nico5038
by: nico5038 | last post by:
Access 2007 Linkedtable manager refuses to relink tables having a field with the "Attachment" datatype. Problem: When placing a split database in another folder, the Linked table manager should...
9
by: haniss | last post by:
After importing a txt delimited file into Access 2007 with adding Couonter there is a problem with column order. For example in txt file: John|Doe|25.10.2007 in new Access table are 4...
1
by: Jim Mandala | last post by:
I had a user that converted an application from Access 2003 to Access 2007. The application is split front-end/backj end. When trying to open certain forms, the front end reportst that they don't...
4
by: netnewbie78 | last post by:
Hello All, I don't have a problem (but maybe I will after I explain). I have a question with regards to something I saw in Access 2007. But first, a little backstory: I'm writing a very small...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.