473,767 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not just returning value of selected record

Hi,

I posted a badly worded question last week so got no replies and am
still struggling to figure out the problem myself. I have a table
containing two fields, Location and Serial Number. I want to display
some of the serial number values on a form which will have a diagram
overlaid (to map out the "locations" ).

I have been trying to write an If statement in the controlsource
properties of the text boxes to say "if location=positi on1 then serial
number, else "?"

=iif ([Location]![Location]="position1" ,[Location]![SN],"?")

This only evaluates the record I am displaying and so would have to
toggle through to see each one in turn. But I want to be able to see
all the records displayed on the form at once i.e evaluate the if
statement against every record in the table, not just the selected
one.

Is this possible or am I barking up the wrong tree?

thanks

Little Viking Girl

Mar 19 '07 #1
5 1697
Try using a query and a calculated field with your expression:

Field1: Location
Field2: Serial Number
Field3: IIF([Location]="position1" ,[Serial Number],"?")

This will evaluate every record in the table. Then you can use the query
results in the form instead of the table.

li************* *@hotmail.com wrote:
>Hi,

I posted a badly worded question last week so got no replies and am
still struggling to figure out the problem myself. I have a table
containing two fields, Location and Serial Number. I want to display
some of the serial number values on a form which will have a diagram
overlaid (to map out the "locations" ).

I have been trying to write an If statement in the controlsource
properties of the text boxes to say "if location=positi on1 then serial
number, else "?"

=iif ([Location]![Location]="position1" ,[Location]![SN],"?")

This only evaluates the record I am displaying and so would have to
toggle through to see each one in turn. But I want to be able to see
all the records displayed on the form at once i.e evaluate the if
statement against every record in the table, not just the selected
one.

Is this possible or am I barking up the wrong tree?

thanks

Little Viking Girl
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200703/1

Mar 19 '07 #2
Thanks for the suggestion but the problem I have with using a query is
that there is more than one position I want to display, closer in fact
to 100. So I'd have to write a query for position1, another for
position2, and so on. I can't do it by prompting user input
([Location:] in criteria) as again I want to display multiple values,
not just the one for position1.

Maybe I need to describe my problem better? Say there is a floor plan
of an office and you want to display the serial number of each PC,
printer etc on the floor plan. They are all stored in the table but
with names like "desk1" and "desk2" as the locations and people may
not know where these positions relate to physically. So I want to have
numerous text boxes on the form, each one evaluating a different
location in the table in order to give a visual representation of the
locations.

Hope this makes more sense now and if I'm wrong about the query /
still not using it correctly then please let me know,

thanks again

little viking girl
Mar 20 '07 #3
It sounds like you can present this information in a map with location names
and a corresponding table that lists the serial numbers at each location. I
think I understand what you're trying to achieve, but it seems impractical
because a desk may have no items or it could have 10 items. Is there enough
space to list 10 serial numbers? What happens if that list needs to grow
even further?

If you really want to do it your way, create an empty table of locations
(unique) and serial numbers. Then, use an update query to add each serial
number field by joining with your original table on the field location and
something like:

IIF(IsNull([Serial Number]),[OriginalSerialN umber],[Serial Number] & ", " &
[OriginalSerialN umber])

The result will be a list of locations and all of the serial numbers at that
location. Then, you can place a textbox at each location and draw the data
from the newly populated serial number field. You'll find more information
about doing this if you search for "transpose" or "concatenat e" in these
forums.
li************* *@hotmail.com wrote:
>Thanks for the suggestion but the problem I have with using a query is
that there is more than one position I want to display, closer in fact
to 100. So I'd have to write a query for position1, another for
position2, and so on. I can't do it by prompting user input
([Location:] in criteria) as again I want to display multiple values,
not just the one for position1.

Maybe I need to describe my problem better? Say there is a floor plan
of an office and you want to display the serial number of each PC,
printer etc on the floor plan. They are all stored in the table but
with names like "desk1" and "desk2" as the locations and people may
not know where these positions relate to physically. So I want to have
numerous text boxes on the form, each one evaluating a different
location in the table in order to give a visual representation of the
locations.

Hope this makes more sense now and if I'm wrong about the query /
still not using it correctly then please let me know,

thanks again

little viking girl
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200703/1

Mar 20 '07 #4
For my situation there will only ever be one piece of hardware with a
unique serial number at each uniquely named location. Therefore
shouldn't I be able to draw from my original [Location] table
directly? I can understand the query is grouping together all serial
numbers at a particular location but I don't need to do that as there
are never 2 items in one spot.

I am struggling to understand how transpose and concatenate help in
this case but will continue to read through more posts. As for drawing
the data from the new table to display in the text box I am back to my
original problem of when I do an iif on the table it only reports the
value / evaluates it against the first record. Maybe I'm getting too
confused.

thanks again

little viking girl

Mar 20 '07 #5
Your form will only present data from one record at a time so instead of
concatenating the data into unique locations, concatenate all of the data
into one record (probably a memo type):
Location1Serial Number1Location 2SerialNumber2L ocation3SerialN umber3... Then,
at each location on the map, you'd have a textbox that evaluates that string
by doing something like:

Mid([LongString],Instr([LongString],"Position11")+ 10,12)

This breaks apart the long string by looking for a specific position and
looking for the characters that follow it. In this example, I've assumed
that all serial numbers are 12 characters long. You can do this artificially
by padding the length. Each textbox would look for a different "Position"
and return that part of the string that follows that exact sequence of
characters. You could devise a way to prevent duplicates and shorten the
string, but the bottom line is that this has to be in one record if you don't
want to programmaticall y assign values. hth
li************* *@hotmail.com wrote:
>For my situation there will only ever be one piece of hardware with a
unique serial number at each uniquely named location. Therefore
shouldn't I be able to draw from my original [Location] table
directly? I can understand the query is grouping together all serial
numbers at a particular location but I don't need to do that as there
are never 2 items in one spot.

I am struggling to understand how transpose and concatenate help in
this case but will continue to read through more posts. As for drawing
the data from the new table to display in the text box I am back to my
original problem of when I do an iif on the table it only reports the
value / evaluates it against the first record. Maybe I'm getting too
confused.

thanks again

little viking girl
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200703/1

Mar 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5253
by: Coz | last post by:
Hi all, I'm looking for help again!!! I have been writing a page to update a database but now have another 'silly' problem with listbox's...Grrr... I'm trying to populate the list box with static values pre-programmed into the page and then set the listbox value to that of the one contained in the database for that particular record the code I'm using is - <select name="SelectGarage">
9
5109
by: Bob Bedford | last post by:
I've a form that use a combobox along with other fields. When the user submit the form, many tests are done. If any test fails, then I show the form again with previously entered values. My problem: when I show back the form with previously entered values, I can't set the entered value of the combobox. I've registered the value, but how to go trough the value, and select the right one. I'd like something like:
4
14596
by: gimme_this_gimme_that | last post by:
Hi, I Oracle one can have : select to_char(a_id_seq.nextval,'0000') from dual Which fetches a sequence value and pads it with zeros on the left. When the sequence value is more than 4 digits '####' is returned.
8
12105
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
4
2107
by: Martyn Fewtrell | last post by:
I want to update a database record with a number of fields - doesn't sound to difficult at this stage! I have a system to select the correct record from the database and load the data into a form across a number of text boxes and a single drop down list (the idea being that the text boxes can be edited and the drop down listed altered to reflect a new value if necessary). The drop down list in the form is loaded from the appropriate...
7
2195
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
2
5939
by: Nathan Sokalski | last post by:
I have a DropDownList that is returning the value from index 0 regardless of which item is selected. The code that I am using to test which index it is returning is: Label1.Text = ddlDeleteEvents.SelectedIndex This is the first line of code in a Button's Click event handler, so I know that there is no other code changing the selected value before I use it. What is happening here? Any help would be appreciated. Thanks.
2
7373
by: David Jackson | last post by:
Hello, I'm using VS.NET 2005. I have a ListView populated with data pulled from a SQL Server database. I have wired up a SelectedIndexChanged event, but I can't find any way of retrieving the value of the previously selected record. For example, if the ListView looks like this:
1
5901
by: Constantine AI | last post by:
Here is the situation i am currently trying to update a sales order using PHP and javascript. When you click on the edit button it brings you a new site page with existing sales order details within. I am wanting the order lines to be within option boxes so they can modify the order if they wish. I created some javascript for the create sale site page which automatically assigned a price to a particular product once selected. Here is the code...
0
10168
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
10009
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
9959
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
9838
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...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
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
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.