Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strsql basics

Status
Not open for further replies.

Emblem1

Technical User
Jan 11, 2007
77
US
Still learning here.

Looking for the basic way to write strsql and vba to do the following.

Form Name - frmFailedLoopsAddNew
Combobox Name - cboLocationName
Textbox Name - location_number

Table Name - tblIntersectionData
Table Fields - INT #
- Location Name

Here is what I have.


Private Sub cboLocationName_AfterUpdate()

Dim strsql As String

strsql = "SELECT [INT #] FROM [tblIntersectionData]"
strsql = strsql & " Where (((tblIntersectionData.[Intersection Name]) = [Forms]![frmFailedLoopsAddNew]![cboLocation])) "


I want vba to refer to the table and fill the location_number text box with the matching INT # based on the intersection name in the combo box. Seems pretty basic to most of you but I can't seem to figure it out. Surfing web code is helping but also confusing.

I think I have the statement right, but not sure what to do with the data.

Thanks!
 
I'd use the DLookUp function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top