473,396 Members | 1,814 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,396 software developers and data experts.

Unbound combo box selecting records w/same name but different Lot Number

I am fairly new to Access and may not ask this question appropriately but here goes.....

I am creating a medication database for a physician's office. I have it setup in a form and it works just like I want it too until I have two or more drugs with the same lot number.

Here goes:

I have an unbound combo box in the header of my form. I click on the arrow to show the records in the table. If I have a drug named advil with a lot number of 1234 and another drug named zinc with a lot number of 1234 it always goes to the Advil, even though I clicked on zinc. How can I get the selected item to show up in the detail area of my form?
Oct 8 '07 #1
2 2235
nico5038
3,080 Expert 2GB
A combobox will use the "bound field" (see the properties window for the combobox under the datatab).
As you use the lot number that's not unique, you'll always get the first.
One option is to set the bound field to the description, or add the unique productID and use that.

When you want to show all medicins for a lot, you'll need to define a frmLot form bound to the lot and a subform for the medicins. The Access subform wizard will propose a link field and when you accept the proposal, then only the medicins of that lot will show.

Getting the idea ?

Nic;o)
Oct 8 '07 #2
missinglinq
3,532 Expert 2GB
In Design View of the query underlying your form, create a new, calculated field named LotAndDrug, by entering this in a blank Field box:

LotAndDrug: [YourLotNumberFieldName] & " " & [YourDrugFieldName]

Now, delete the combobox you have and use the wizard to create a new one. Select the third option "Find a record based on the value I selected in my combobox."

Hit Next

Now, from the same query the form is based on, click on the field you've just created, LotAndDrug, to move it into the right hand box. This is the field that will appear in your combobox.

Click thru the wizard to finish the process.

Now, when you go into your combobox you'll see

1234 Advil
1234 Zinc

and if you click on 1234 Zinc that's the record that will be retrieved, not 1234 Advil.

If you wanted to retrieve records by the drug name and lot number, instead of lot number and drug name, simply replace

LotAndDrug: [YourLotNumberFieldName] & " " & [YourDrugFieldName]

with LotAndDrug: [YourDrugFieldName] & " " & [YourLotNumberFieldName]

In this kind of situation, nico, there's no relationship between lot numbers, so there probably wouldn't be any reason to retrieve or group records by lot numbers.

Welcome to TheScripts!

Linq ;0)>
Oct 8 '07 #3

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

Similar topics

3
by: sao | last post by:
I am currently using Access 2000. In my table it is the following fields that are set up: 1 - Staff Name 2 - Department This table is already populated with 100+ records (staff along with...
1
by: Herb E | last post by:
When selecting records from a combo box, everything works fine if the Item Number is typed in. For example, if I type in FC9612 it executes properly. However, in most instances, the item number...
2
by: Todd | last post by:
Hello, I'm curious if anyone knows of a way (if one exists) to tell a form (in Access 2002 VBA) to sort on an unbound column of a combo box on the form. Here's what I want to do: A combo box...
2
by: Todd | last post by:
Hi. I want to sort the records on my form (using either a continuous form or a datasheet) by the unbound "description" column in a combo box on the form (or in the datasheet.) Here's a rough...
10
by: Bob Darlington | last post by:
I am using the following SQL as a RowSource for a combo box on a form. "SELECT LAN, TenantName as , ShopNum as FROM qTenantSelect " The field 'ShopNum' is a text field and has a caption...
0
by: Wolfgang Kreuzer | last post by:
Hi, I am starting to migrate an Access 2.0 application to Access 2000 (I know it's not the latest version, but ist supported in our company). I found some funny behaviours where I could not...
5
by: David | last post by:
Hi I seem to be getting nowhere with this. I am opening a form which will be used to input Notes into different fields in a table. My problem is changing the unbound field name to the field name...
3
by: Stig | last post by:
Hi, Any help on this one will be greatly appreciated as I have spent too long banging my head against the screen trying to get it sorted. Basically I would like to have a select all records...
2
by: banderson | last post by:
Hello, I have a data entry form for a table with information about buildings and am having a problem making a combo box do what I want. I would like to make the combo box show a list of unique bldg...
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...
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
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,...
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
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...
0
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...

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.