Grabbing text data from a form.

Posted on 2005-05-12
Last Modified: 2006-11-18
I have a form with numerous tabs in it. In one of the tabs I have a text box control, from which I want to grab the text to use in a query. In the query, I want to pull all the data from a table where one feild, "serial number" ( a text feild) matches the data I grabbed from the form control.
My query returns nothing, which should not be the case.
This is the code I've used to grab the data:


frm_Main: Name of the form
TabCtl16: Name of the Tab
Chamber: Name of the text feild

I've tried using text(([Forms]![frm_Main]![TabCtl16]![Chamber])) as well..
but query comes out as a blank even though I've made sure I typed an existing serial number in the form text feild that resides in "serial number" feild in dbo_Incidents table that I'm qurying from.

This is the query that is used:

SELECT dbo_Incident.IncidentID, dbo_Incident.IncidentNo, dbo_Incident.SequenceNo, dbo_Incident.ItemDeleted, dbo_Company.CompanyName, dbo_IncidentCategory.Category, dbo_Product.Product, dbo_IncidentActionTask.ActionTask, dbo_IncidentStatus.Status, dbo_Incident.DueDate, dbo_Incident.Unit, dbo_Incident.LastServiceDate, dbo_Incident.SerialNumber, dbo_Incident.OrderNumber, dbo_Incident.DatePartsReceived, dbo_Incident.ModifiedStartDate, dbo_Incident.ModifiedEndDate, dbo_Incident.FirstSequenceCreatedDate, dbo_Incident.FirstSequenceCreatedID, dbo_Incident.Keyword, dbo_Incident.Problem, dbo_Incident.Solution, dbo_Incident.LockedDate, dbo_Incident.ItemID, dbo_Incident.Priority, dbo_Incident.SalesRepID1, dbo_Incident.ServiceTypeID
FROM (((((dbo_Incident LEFT JOIN dbo_Company ON dbo_Incident.CompanyID = dbo_Company.CompanyID) LEFT JOIN dbo_IncidentCategory ON dbo_Incident.CategoryID = dbo_IncidentCategory.CategoryID) LEFT JOIN dbo_IncidentActionTask ON dbo_Incident.ActionTaskID = dbo_IncidentActionTask.ActionTaskID) LEFT JOIN dbo_Product ON dbo_Incident.ProductID = dbo_Product.ProductID) LEFT JOIN dbo_IncidentStatus ON dbo_Incident.StatusID = dbo_IncidentStatus.StatusID) LEFT JOIN dbo_IncidentUnitType ON dbo_Incident.UnitTypeID = dbo_IncidentUnitType.UnitTypeID
WHERE (((dbo_Incident.ItemDeleted)=0) AND ((dbo_Product.Product)="xrx") AND ((dbo_IncidentStatus.Status)="open") AND ((dbo_Incident.SerialNumber)=([Forms]![frm_Main]![TabCtl16]![Chamber])));

Let me know where I'm screweing up..

Thanks a bunch.

Question by:javalite
    LVL 7

    Accepted Solution

    I'm going to suggest  a lazy person way to solve this.. and I hope it works..    have you tried  ([Forms]![frm_Main]![Chamber])  

    Author Comment

    you're the champ.. I read some where that if you use a tab, u have to include the tab name as well.. but what u know.. ur solution works..
    thanks mate..!
    LVL 7

    Expert Comment

    welcome...   thanks   for the points...

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now