retyping same info to get update

dhunter

Registered User.
Local time
Today, 15:17
Joined
Jul 1, 2009
Messages
26
Sorry ahead of time if my terminology is not correct.

I have one table: SOW's
I have a bunch of columns in that table, two main columns:
SOW_Num - long integer
Customer - text
There are several (even duplicate) SOW_NUM for one customer

On my form I have a combo box for Customer
I have a list box for SOW_Num

I want the user to select a customer from the combo box and then the list box gets updated with only the sow numbers for that specific customer. It works right now however, I am being asked to manually type the name of the customer again after I have selected one. As soon as I type it in exactly the lisbox works correctly.

I have two subforms that are populating based upon that information as well but they are working, as long as I type in the customer name again.

Here is my code for the combo box:

Private Sub cbo_Customer_AfterUpdate()

Me.lbx_SOW_Num.RowSource = "SELECT tbl_ALL_SOW.SOW_Num" & _
" FROM tbl_ALL_SOW" & _
" WHERE tbl_ALL_SOW.Customer = " & _
Me.tbx_Customer.Value


End Sub

My eyes are going cross-eyed, any help would be appreciated!!
 
You say Customer is defined as Text, but your Where statement

WHERE tbl_ALL_SOW.Customer = " & Me.tbx_Customer.Value

is the correct syntax for a Number Datatype. The correct syntax for Text would be

WHERE tbl_ALL_SOW.Customer = '" & Me.tbx_Customer.Value & "'"
 
Thanks so much for your help!! I don't know very much about the syntax rules, whatever I do know has come from web searches and other people showing me.

The form works beautifully!!!! Thank you!!!!

Would you happen to know where I can get information about creating something like an archive?

For example on this same form, the user wants to add a button that will remove the record from the table and place it in an archive table. Know any place(sites) I could look for that?

Thanks again!!!
 
Glad we could help!

The way most developers go about archiving is to not actually delete records. Instead, they add an 'archive' checkbox which is checked when the record needs to be 'deleted.' The form to show active records is based on a query that only shows records where the archived checkbox is not ticked, the form to show 'archived' records on a query where the archive checkbox is ticked. . An added advantage is that an erroneously 'deleted' record can be re-instated by simply unticking the checkbox.
 

Users who are viewing this thread

Back
Top Bottom