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

module If statement help

Status
Not open for further replies.

kimchavis

Technical User
Jan 7, 2004
66
US
Hi Everyone! Im new to Access and VBA and am trying to create an IF statement in a module to call in a query and IM getting a "Compile Error: External Name not defined" error. Im using Access 2003 and following is my module entry that im attempting to call:

Public Function status() As String



If [tbl GMAC Today3]![funded] <> [tbl GMAC Yesterday]![funded] Then status = True Else

If [tbl GMAC Yesterday]![investor] <> [tbl GMAC Today3]![investor] Then status = True Else

If [tbl GMAC Today3]![branch_type] <> [tbl GMAC Yesterday]![branch_type] Then status = True Else

If [tbl GMAC Yesterday]![short_name] <> [tbl GMAC Today3]![short_name] Then status = True Else

If [tbl GMAC Yesterday]![Purchase] <> [tbl GMAC Today3]![Purchase] Then status = True Else

If [tbl GMAC Yesterday]![borrow_ssn] <> [tbl GMAC Today3]![borrow_ssn] Then status = True Else

If [tbl GMAC Yesterday]![borrow_ln] <> [tbl GMAC Today3]![borrow_ln] Then status = True Else

If [tbl GMAC Yesterday]![borrow_fn] <> [tbl GMAC Today3]![borrow_fn] Then status = True Else

If [tbl GMAC Yesterday]![borrow_mn] <> [tbl GMAC Today3]![borrow_mn] Then status = True Else

If [tbl GMAC Yesterday]![borr_phone] <> [tbl GMAC Today3]![borr_phone] Then status = True Else

If [tbl GMAC Yesterday]![borr_work] <> [tbl GMAC Today3]![borr_work] Then status = True Else

If [tbl GMAC Yesterday]![appras_val] <> [tbl GMAC Today3]![appras_val] Then status = True Else

If [tbl GMAC Yesterday]![assumability] <> [tbl GMAC Today3]![assumability] Then status = True Else

If [tbl GMAC Yesterday]![borr_fico] <> [tbl GMAC Today3]![borr_fico] Then status = True Else

If [tbl GMAC Yesterday]![buydown] <> [tbl GMAC Today3]![buydown] Then status = True Else

If [tbl GMAC Yesterday]![cltv] <> [tbl GMAC Today3]![cltv] Then status = True Else

If [tbl GMAC Yesterday]![cborr_fico] <> [tbl GMAC Today3]![cborr_fico] Then status = True Else

If [tbl GMAC Yesterday]![floor_rate] <> [tbl GMAC Today3]![floor_rate] Then status = True Else

If [tbl GMAC Yesterday]![req_setup] <> [tbl GMAC Today3]![req_setup] Then status = True Else

If [tbl GMAC Yesterday]![index_type] <> [tbl GMAC Today3]![index_type] Then status = True Else

If [tbl GMAC Yesterday]![index_val] <> [tbl GMAC Today3]![index_val] Then status = True Else

If [tbl GMAC Yesterday]![lien] <> [tbl GMAC Today3]![lien] Then status = True Else

If [tbl GMAC Yesterday]![prog_name] <> [tbl GMAC Today3]![prog_name] Then status = True Else

If [tbl GMAC Yesterday]![loan_term] <> [tbl GMAC Today3]![loan_term] Then status = True Else

If [tbl GMAC Yesterday]![loan_type] <> [tbl GMAC Today3]![loan_type] Then status = True Else

If [tbl GMAC Yesterday]![prog_type] <> [tbl GMAC Today3]![prog_type] Then status = True Else

If [tbl GMAC Yesterday]![ltv] <> [tbl GMAC Today3]![ltv] Then status = True Else

If [tbl GMAC Yesterday]![num_units] <> [tbl GMAC Today3]![num_units] Then status = True Else

If [tbl GMAC Yesterday]![owner_occu] <> [tbl GMAC Today3]![owner_occu] Then status = True Else

If [tbl GMAC Yesterday]![prepay_pen] <> [tbl GMAC Today3]![prepay_pen] Then status = True Else

If [tbl GMAC Yesterday]![prepay_mos] <> [tbl GMAC Today3]![prepay_mos] Then status = True Else

If [tbl GMAC Yesterday]![prepay_ineffect] <> [tbl GMAC Today3]![prepay_ineffect] Then status = True Else

If [tbl GMAC Yesterday]![prop_no] <> [tbl GMAC Today3]![prop_no] Then status = True Else

If [tbl GMAC Yesterday]![prop_street] <> [tbl GMAC Today3]![prop_street] Then status = True Else

If [tbl GMAC Yesterday]![prop_city] <> [tbl GMAC Today3]![prop_city] Then status = True Else

If [tbl GMAC Yesterday]![prop_state] <> [tbl GMAC Today3]![prop_state] Then status = True Else

If [tbl GMAC Yesterday]![prop_zip] <> [tbl GMAC Today3]![prop_zip] Then status = True Else

If [tbl GMAC Yesterday]![prop_type] <> [tbl GMAC Today3]![prop_type] Then status = True Else

If [tbl GMAC Yesterday]![purch_pric] <> [tbl GMAC Today3]![purch_pric] Then status = True Else

If [tbl GMAC Yesterday]![subordinate] <> [tbl GMAC Today3]![subordinate] Then status = True Else

If [tbl GMAC Yesterday]![gross_margin] <> [tbl GMAC Today3]![gross_margin] Then status = True Else

If [tbl GMAC Yesterday]![margin] <> [tbl GMAC Today3]![margin] Then status = True Else

If [tbl GMAC Yesterday]![loan_amt] <> [tbl GMAC Today3]![loan_amt] Then status = True Else

If [tbl GMAC Yesterday]![mi_comp] <> [tbl GMAC Today3]![mi_comp] Then status = True Else

If [tbl GMAC Yesterday]![mi_perc] <> [tbl GMAC Today3]![mi_perc] Then status = True Else

If [tbl GMAC Yesterday]![mail_street] <> [tbl GMAC Today3]![mail_street] Then status = True Else

If [tbl GMAC Yesterday]![mail_city] <> [tbl GMAC Today3]![mail_city] Then status = True Else

If [tbl GMAC Yesterday]![mail_state] <> [tbl GMAC Today3]![mail_state] Then status = True Else

If [tbl GMAC Yesterday]![mail_zip] <> [tbl GMAC Today3]![mail_zip] Then status = True Else

If [tbl GMAC Yesterday]![first_pay_adj] <> [tbl GMAC Today3]![first_pay_adj] Then status = True Else

If [tbl GMAC Yesterday]![first_pmt] <> [tbl GMAC Today3]![first_pmt] Then status = True Else

If [tbl GMAC Yesterday]![first_rate_adj] <> [tbl GMAC Today3]![first_rate_adj] Then status = True Else

If [tbl GMAC Yesterday]![sub_pay_adj] <> [tbl GMAC Today3]![sub_pay_adj] Then status = True Else

If [tbl GMAC Yesterday]![sub_rate_adj] <> [tbl GMAC Today3]![sub_rate_adj] Then status = True Else

If [tbl GMAC Yesterday]![flood_zone] <> [tbl GMAC Today3]![flood_zone] Then status = True Else

If [tbl GMAC Yesterday]![mers_no] <> [tbl GMAC Today3]![mers_no] Then status = True Else

If [tbl GMAC Yesterday]![last_pmt] <> [tbl GMAC Today3]![last_pmt] Then status = True Else

If [tbl GMAC Yesterday]![fha_va_case] <> [tbl GMAC Today3]![fha_va_case] Then status = True Else

If [tbl GMAC Yesterday]![next_pay_adj] <> [tbl GMAC Today3]![next_pay_adj] Then status = True Else

If [tbl GMAC Yesterday]![next_rate_adj] <> [tbl GMAC Today3]![next_rate_adj] Then status = True Else

If [tbl GMAC Yesterday]![note_date] <> [tbl GMAC Today3]![note_date] Then status = True Else

If [tbl GMAC Yesterday]![county] <> [tbl GMAC Today3]![county] Then status = True Else

If [tbl GMAC Yesterday]![purpose] <> [tbl GMAC Today3]![purpose] Then status = True Else

If [tbl GMAC Yesterday]![refi_purpose] <> [tbl GMAC Today3]![refi_purpose] Then status = True Else

If [tbl GMAC Yesterday]![cborrow_ssn] <> [tbl GMAC Today3]![cborrow_ssn] Then status = True Else

If [tbl GMAC Yesterday]![cborrow_ln] <> [tbl GMAC Today3]![cborrow_ln] Then status = True Else

If [tbl GMAC Yesterday]![cborrow_fn] <> [tbl GMAC Today3]![cborrow_fn] Then status = True Else

If [tbl GMAC Yesterday]![cborrow_mn] <> [tbl GMAC Today3]![cborrow_mn] Then status = True Else

If [tbl GMAC Yesterday]![cborrow_surname] <> [tbl GMAC Today3]![cborrow_surname] Then status = True Else

If [tbl GMAC Yesterday]![spouse_surname] <> [tbl GMAC Today3]![spouse_surname] Then status = True Else

If [tbl GMAC Yesterday]![cborr_phone] <> [tbl GMAC Today3]![cborr_phone] Then status = True Else

If [tbl GMAC Yesterday]![cborr_work] <> [tbl GMAC Today3]![cborr_work] Then status = True Else

If [tbl GMAC Yesterday]![init_rate] <> [tbl GMAC Today3]![init_rate] Then status = True Else

If [tbl GMAC Yesterday]![spouse_ln] <> [tbl GMAC Today3]![spouse_ln] Then status = True Else

If [tbl GMAC Yesterday]![spouse_fn] <> [tbl GMAC Today3]![spouse_fn] Then status = True Else

If [tbl GMAC Yesterday]![spouse_mn] <> [tbl GMAC Today3]![spouse_mn] Then status = True Else

If [tbl GMAC Yesterday]![spouse_ssn] <> [tbl GMAC Today3]![spouse_ssn] Then status = True Else

If [tbl GMAC Yesterday]![spouse_home_phone] <> [tbl GMAC Today3]![spouse_home_phone] Then status = True Else

If [tbl GMAC Yesterday]![spouse_job_phone] <> [tbl GMAC Today3]![spouse_job_phone] Then status = True Else

If [tbl GMAC Yesterday]![arm_type] <> [tbl GMAC Today3]![arm_type] Then status = True Else

If [tbl GMAC Yesterday]![buydown_rate1] <> [tbl GMAC Today3]![buydown_rate1] Then status = True Else

If [tbl GMAC Yesterday]![buydown_rate2] <> [tbl GMAC Today3]![buydown_rate2] Then status = True Else

If [tbl GMAC Yesterday]![buydown_rate3] <> [tbl GMAC Today3]![buydown_rate3] Then status = True Else

If [tbl GMAC Yesterday]![buydown_term] <> [tbl GMAC Today3]![buydown_term] Then status = True Else

If [tbl GMAC Yesterday]![buydown_type] <> [tbl GMAC Today3]![buydown_type] Then status = True Else

If [tbl GMAC Yesterday]![Conversion] <> [tbl GMAC Today3]![Conversion] Then status = True Else

If [tbl GMAC Yesterday]![const_existing_liens] <> [tbl GMAC Today3]![const_existing_liens] Then status = True Else

If [tbl GMAC Yesterday]![const_improve_cost] <> [tbl GMAC Today3]![const_improve_cost] Then status = True Else

If [tbl GMAC Yesterday]![estate_held] <> [tbl GMAC Today3]![estate_held] Then status = True Else

If [tbl GMAC Yesterday]![initial_cap] <> [tbl GMAC Today3]![initial_cap] Then status = True Else

If [tbl GMAC Yesterday]![leasehold_expire] <> [tbl GMAC Today3]![leasehold_expire] Then status = True Else

If [tbl GMAC Yesterday]![cap] <> [tbl GMAC Today3]![cap] Then status = True Else

If [tbl GMAC Yesterday]![loan_type_other] <> [tbl GMAC Today3]![loan_type_other] Then status = True Else

If [tbl GMAC Yesterday]![marg_desc1] <> [tbl GMAC Today3]![marg_desc1] Then status = True Else

If [tbl GMAC Yesterday]![marg_desc2] <> [tbl GMAC Today3]![marg_desc2] Then status = True Else

If [tbl GMAC Yesterday]![marg_desc3] <> [tbl GMAC Today3]![marg_desc3] Then status = True Else

If [tbl GMAC Yesterday]![marg_fee1] <> [tbl GMAC Today3]![marg_fee1] Then status = True Else

If [tbl GMAC Yesterday]![marg_fee2] <> [tbl GMAC Today3]![marg_fee2] Then status = True Else

If [tbl GMAC Yesterday]![marg_fee3] <> [tbl GMAC Today3]![marg_fee3] Then status = True Else

If [tbl GMAC Yesterday]![const_orig_cost] <> [tbl GMAC Today3]![const_orig_cost] Then status = True Else

If [tbl GMAC Yesterday]![pay_adj_period] <> [tbl GMAC Today3]![pay_adj_period] Then status = True Else

If [tbl GMAC Yesterday]![prepay_perc] <> [tbl GMAC Today3]![prepay_perc] Then status = True Else

If [tbl GMAC Yesterday]![refi_year_acquired] <> [tbl GMAC Today3]![refi_year_acquired] Then status = True Else

If [tbl GMAC Yesterday]![refi_orig_cost] <> [tbl GMAC Today3]![refi_orig_cost] Then status = True Else

If [tbl GMAC Yesterday]![land_cost] <> [tbl GMAC Today3]![land_cost] Then status = True Else

If [tbl GMAC Yesterday]![prog_type_other] <> [tbl GMAC Today3]![prog_type_other] Then status = True Else

If [tbl GMAC Yesterday]![purpose_other] <> [tbl GMAC Today3]![purpose_other] Then status = True Else

If [tbl GMAC Yesterday]![rate_adj_period] <> [tbl GMAC Today3]![rate_adj_period] Then status = True Else

If [tbl GMAC Yesterday]![rate_desc1] <> [tbl GMAC Today3]![rate_desc1] Then status = True Else

If [tbl GMAC Yesterday]![rate_desc2] <> [tbl GMAC Today3]![rate_desc2] Then status = True Else

If [tbl GMAC Yesterday]![rate_desc3] <> [tbl GMAC Today3]![rate_desc3] Then status = True Else

If [tbl GMAC Yesterday]![refi_amount] <> [tbl GMAC Today3]![refi_amount] Then status = True Else

If [tbl GMAC Yesterday]![refi_existing_liens] <> [tbl GMAC Today3]![refi_existing_liens] Then status = True Else

If [tbl GMAC Yesterday]![refi_imprv_desc] <> [tbl GMAC Today3]![refi_imprv_desc] Then status = True Else

If [tbl GMAC Yesterday]![refi_when_made] <> [tbl GMAC Today3]![refi_when_made] Then status = True Else

If [tbl GMAC Yesterday]![refi_improve_cost] <> [tbl GMAC Today3]![refi_improve_cost] Then status = True Else

If [tbl GMAC Yesterday]![subseq_cap] <> [tbl GMAC Today3]![subseq_cap] Then status = True Else

If [tbl GMAC Yesterday]![doc_type] <> [tbl GMAC Today3]![doc_type] Then status = True Else GoTo 0



End If

End Function


Any assistance you could provide me would be greatly appreciated.

Thanks,
KIM
 
Query
------
SELECT YourFunction(variable1, variable2, ... variableN),
Field1, Field2,....
FROM YourTable1 Inner Join YourTable2 On
YourTable1.ID=YourTable2,ID;


Module
------
Function Status(Variable1 As Long, Variable2 As Long, _
..., variableN As Date) As Boolean

Dim myStatus As Boolean

myStatus = (Variable1<>Variable2)
myStatus = myStatus OR (Variable3<>Variable4)
....


Status = myStatus
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top