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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have a value show on a form based on a query

Status
Not open for further replies.

gcrutch70

Programmer
Oct 21, 2009
11
US
I have a form it has several text boxes, fields and a subform. it has a parameter that prompts for a SerialNbr.
The fields on the form are SerialNbr, cboCartStatus, CartDate, CartID, ServiceID
Subform fields: cboCartEvent, CartID, CartEventSubType, CartEventDate

The control source for the form is a query that uses the table tbl_Cart. the fields in the tbl_Cart are: CartID, SerialNbr, ServiceID, CartStatus, CartStatusDate
and the tbl_Cart is related to the tbl_Services and its fields are: ServiceID, AddressID, ServiceStatus, NbrCarts, etc

The AddressID comes from a view which is the basis for the entire application. So a veiw was created based on the Services table and the vAddress view this is where the vService_Address comes from. It returns all matching records that has an address that's related to a service.

Hence, what the form does is...when the form is opened it asks the user for a SerialNbr. ONce the serial nbr is entered it brings up the record that is associated with that SerialNbr.


The following pseudocode was given to me saying this is how I need to do it. Can someone help me turn this pseudocode in to VBA code.


On the Cart Form, insert an Address label under the “Cart Update” title.
In the Form Load subroutine, set the default caption to “Address Unknown”.
Query the Cart table using the Serial Number as the parameter.
If the query returns a record, check the ServiceID.
If it is not null, then query view vService_Address using the ServiceID as the parameter.
Set the Address label to the concatenated address returned by the query
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top