473,473 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Fill in a form field based on criteria in another

2 New Member
I am sure this is easy but I can't seem to do it. I have a table, PartNumberTableCond, that has two column, PartNumber and PartDescription. I have a Form, Input, that I want to be able to put in a number from PartNumberTableCond, using a combo box, cboPartNumber, or just key in a new number. Then I want my PartDescription field to fill-in automatically if the number in cboPartNumbers is an existing part number. I think I need to put some code into the After Update Event but I cannot find code that will work. Here is what I have in there now and I think it is for a situation where I have two combo boxes and I think I need to change "RowSource" to something else:

Private Sub cboPartNumber_AfterUpdate()

Dim sPartDescriptionSource As String

sCPartDescriptionSource = "SELECT [PartNumberTableCond].[PartDescription]," & _
"FROM PartNumberTableCond " & _
"WHERE [PartNumber] = " & Me.cboPartNumber.Value
Me.PartDescription.RowSource = sPartDescriptionSource
Me.PartDescription.Requery
End Sub

Can anybody offer a simple solution for a simple person?!?!?

Thanks!!

BoydSue
Sep 27 '07 #1
1 1957
tdw
206 New Member
I am sure this is easy but I can't seem to do it. I have a table, PartNumberTableCond, that has two column, PartNumber and PartDescription. I have a Form, Input, that I want to be able to put in a number from PartNumberTableCond, using a combo box, cboPartNumber, or just key in a new number. Then I want my PartDescription field to fill-in automatically if the number in cboPartNumbers is an existing part number. I think I need to put some code into the After Update Event but I cannot find code that will work. Here is what I have in there now and I think it is for a situation where I have two combo boxes and I think I need to change "RowSource" to something else:

Private Sub cboPartNumber_AfterUpdate()

Dim sPartDescriptionSource As String

sCPartDescriptionSource = "SELECT [PartNumberTableCond].[PartDescription]," & _
"FROM PartNumberTableCond " & _
"WHERE [PartNumber] = " & Me.cboPartNumber.Value
Me.PartDescription.RowSource = sPartDescriptionSource
Me.PartDescription.Requery
End Sub

Can anybody offer a simple solution for a simple person?!?!?

Thanks!!

BoydSue
What do you want to have happen if they enter a number that doesn' already exist?
Sep 27 '07 #2

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

Similar topics

2
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
2
by: neptune | last post by:
I have a query where each customer has an or . Sometimes both fields for a customer are populated, but if is null, then will be populated and vice versa. I have a form, , where I select a...
4
by: James | last post by:
Dear group, Can anyone tell me how to do the following? I have a basic list of numbers in a table I want to be able to search these by letting the user type "<10" or ">=50" on a simple form...
3
by: dskillingstad | last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong, but.... I've searched these groups for some solutions but no luck. I have an unbound form (frmSearch), with several unbound...
10
by: motessa | last post by:
Hello All, I am new to Access and have been looking for answers to my problem on the internet and have not found it yet. I hope someone can give me a hint. Thanks so much. I have a form...
4
by: jaYPee | last post by:
I have 1 dataset called "dataset1" that contains 2 tables called "course" and "courseload". in my form i have a datagrid. the datasource of this datagrid is "dataset1" and the datamember is...
2
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
31
by: DWolff | last post by:
I'm somewhat new to Access, and have no VB experience at all (except for modifying existing code where obvious). I built a data entry form that works fine. Typically, a client will call in and...
2
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 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...
1
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...
0
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...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.