WIll this code autofill a textbox from table value with three 'WHERE's?

whitelockben

Registered User.
Local time
Today, 17:20
Joined
Jun 29, 2011
Messages
25
Code:
Private Sub cboC_AfterUpdate()
   On Error Resume Next
   txtW.RowSource = "Select tblCables.W " & _
            "FROM tblCables " & _
            "WHERE tblCables.T = '" & cboT.Value & "' And tblCables.C = '" & cboC.Value & "'  And tblCables.N = '" & cboNCA.Value & "' " & _

End Sub

I have used RowSource, but I am not sure if this is correct. All I want is to have three comboboxes and when each has been selected a spefic piece of info getting from tbl.Cables based upon those selections.

It doesnt have to be distinct because each value will be unie and there will never be more than one record which matches any combination of the three comboboxes.

Thanks in advance!

Ben
 
txtW.RowSource

Without looking, I don't think text boxes have a row source?
Do you mean a combo box?
Or A list box?
 
I actually used rowSource because I dont know what to use for a textbox:o.
 
It would be

Me.txtW.Value

or simply

Me.txtW

since Value is the Default Property for a Textbox and can be omitted. But you cannot use a SELECT Query to populate a Textbox. You'd have to use the DLookup() function, instead.

Linq ;0)>
 
Thank you for the reply it almost makes sense to me haha.

Can you just show me how I would combine three whres and a dlookup with my combobox afterupdate.

Thank you!!
 

Users who are viewing this thread

Back
Top Bottom