Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robwelan/bbf9ee67c8e7dd856ae5e224a7f7387e to your computer and use it in GitHub Desktop.
Save robwelan/bbf9ee67c8e7dd856ae5e224a7f7387e to your computer and use it in GitHub Desktop.
Sub DoWork_LookupTables()
Dim rsCheck As DAO.Recordset
Dim varMsg As Variant
Dim lngResult As Long
Dim strSQL As String
On Error GoTo handle_Error
// Check Applicant Country
Set rsCheck = Nothing
strSQL$ = ReturnStandardQuery$("Count_ExistingApplicantCountryInCountries")
Set rsCheck = CurrentDb.OpenRecordset(strSQL$)
If rsCheck.Fields.Count = 1 Then
lngResult& = rsCheck.Fields(0)
If lngResult& = 0 Then
strSQL$ = ReturnStandardQuery$("Insert_ApplicantCountryInCountries")
If ExecuteSQL(strSQL$) = False Then
varMsg = MsgBox("It was not possible to insert the Applicant's Country Name into the tblCountries table. You will need to seek support.", vbOKOnly, "ERROR: Insert Applicant Country...")
GoTo exit_Gracefully
End If ' ExecuteSQL(strSQL$) = False
End If ' lngResult& = 0
Else
varMsg = MsgBox("The wrong number of records was returned from the 'Count_ExistingApplicantCountryInCountries' query. Seek Support.", vbOKOnly, "ERROR: Returned Data Invalid...")
GoTo exit_Gracefully
End If ' rsCheck.Fields.Count = 1
...
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment