472,126 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Fill in a form field based on criteria in another

2
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 1878
tdw
206 100+
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

Post your reply

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

Similar topics

2 posts views Thread by Iain Miller | last post: by
3 posts views Thread by dskillingstad | last post: by
10 posts views Thread by motessa | last post: by
4 posts views Thread by jaYPee | last post: by
reply views Thread by leo001 | last post: by

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.