Hi, Tek-Tips!
I'm a SQL newbie and I get stuck on the oddest things.
I have a form on which the user enters a date and a type of work. When both of these are filled in, I want SQL to run comparing the values on the form with the values in a lookup table. If the values match, I want to disable the next control on the form. If there is no match, the user should be able to continue.
How do I write my SQL code?
My form (frmSRENExcelImport) fields are:
txtEffective - user-entered short date
txtTOWType - user-chosen from a list of three possibilities
My lookup table (tlkpRenewalImport) fields are:
Effective - short date
TOW - text with a field size of four (all TOW codes are four letters)
I made a query that compares the two:
SELECT tlkpRenewalImport.Effective, tlkpRenewalImport.TOW
FROM tlkpRenewalImport
WHERE (((tlkpRenewalImport.Effective)=[Forms]![frmSRENExcelImport]![txtEffective]) AND ((tlkpRenewalImport.TOW)=[Forms]![frmSRENExcelImport]![txtTOWType]));
but I don't know how to put it into the form module, or how to disable a control based on a result.
Thank you for any help you can give me!
I'm a SQL newbie and I get stuck on the oddest things.
I have a form on which the user enters a date and a type of work. When both of these are filled in, I want SQL to run comparing the values on the form with the values in a lookup table. If the values match, I want to disable the next control on the form. If there is no match, the user should be able to continue.
How do I write my SQL code?
My form (frmSRENExcelImport) fields are:
txtEffective - user-entered short date
txtTOWType - user-chosen from a list of three possibilities
My lookup table (tlkpRenewalImport) fields are:
Effective - short date
TOW - text with a field size of four (all TOW codes are four letters)
I made a query that compares the two:
SELECT tlkpRenewalImport.Effective, tlkpRenewalImport.TOW
FROM tlkpRenewalImport
WHERE (((tlkpRenewalImport.Effective)=[Forms]![frmSRENExcelImport]![txtEffective]) AND ((tlkpRenewalImport.TOW)=[Forms]![frmSRENExcelImport]![txtTOWType]));
but I don't know how to put it into the form module, or how to disable a control based on a result.
Thank you for any help you can give me!