Allen:
Thanks for the words of wisdom. I know it is like remove the bulb from a
warrning light but I am that fruastrated that I can not solve this
problem.
I hope maybe you will be able to help me.
I will start out by first saying I am sorry for all the detail but I know
no
other way to explain my problem. I worry that the detail may be too much
and
scare you away from responding. Please do not let this happen as I am at
wits end and need help badly. Please help.
Here it goes......
To answer your questions:
1) the table (tblccontacts) is a linked table to the "back end" database
(i.e. the database is split)
2) the table contains data that was entered directly into the table via a
form (frmCustomers) while other records have been added by an append
querry.
The overflow error only shows when the form is opend for the records that
have been appended to the table. The appending records come from a table
(tblImpPeopleSoft - all fields are text with a size of 255 by default and
have not been changed) that has been created from a text file. It appears
to
me that the append querry works as the records are added to tblccontacts
and
I can open the table and view all the records.
SQL for append query:
INSERT INTO tblContacts ( ctEnteredDate, ctPeopleSoftID, ctLastName1,
ctFirstName1, ctEnglishLang, ctFrenchLang, ctEmailName, ctPhone1, ctFax,
ctCellPhone, ctCompanyName, ctLcAddress, ctLcCity, ctLcCountry,
ctLcPostalCode, ctLcProvState )
SELECT Date() AS DateEntered, tblImpPeopleSoft.F1, tblImpPeopleSoft.F2,
tblImpPeopleSoft.F3, IIf([F4]="Y",-1,0) AS EnglishLang, IIf([F4]="Y",-1,0)
AS
FrenchLang, tblImpPeopleSoft.F5, tblImpPeopleSoft.F6, tblImpPeopleSoft.F7,
tblImpPeopleSoft.F8, tblImpPeopleSoft.F13, IIf([f22] Is
Null,[F21],IIf([f23]
Is Null,[f21] & ", " & [F22],[f21] & ", " & [F22] & ", " & [f23])) AS
Address, tblImpPeopleSoft.F24, "Canada" AS Country, tblImpPeopleSoft.F26,
tblImpPeopleSoft.F27
FROM tblImpPeopleSoft;
Here are the details of the fields and largest size of data store into
each:
Field Name - Data Type - Field Size - longest record for field
(len([FieldName])
ctEnteredDate - date/time - n/a - 10
ctPeopleSoftID - text - 10 - 5
ctLastName1 - text - 50 - 21
ctFirstName1 - text - 20 - 14
ctEnglishLang - yes/no
ctFrenchLang - yes/no
ctEmailName - text - 50 - 27
ctPhone1 - text - 30 - 22
ctFax - text - 30 - 14
ctCellPhone - text - 30 - 22
ctCompanyName - text - 80 - 30
ctLcAddress - text - 100 - 88
ctLcCity - text - 30 - 28
ctLcCountry - text - 20 - 6
ctLcPostalCode - text - 20 - 7
ctLcProvState - text - 20 - 2
3) The forms is based on the table (tblContacts) and uses the following as
the control source for the form: SELECT tblContacts.* FROM tblContacts;
4) As mentioned above when I open the table and scroll to the end of the
table no error is displayed and if needed I can add a new record.
5) As mentioned above the form is based on a table and there are not
calculated fields.
6) There are no calculated controls on the form. The closest thing is a
couple of combo boxes.
7) I have included ALL the code on the form. Starting with the current
and
open events, followed by any code to do with the fields and then the code
for
any command buttons.
Code on the form:
Private Sub Form_Current()
gbOK = False
If Me!LcCountry = "Canada" Then
Me!LcPostalCode.InputMask = ">L0L\ 0L0"
Else
Me!LcPostalCode.InputMask = ""
End If
End Sub
---------------------------------------------------------------------------------------------
Private Sub Form_Load()
If OpenArgs = "New" Then
Me!fraIntExt = 0
Me!lblIntExt.Visible = False
Me!fraIntExt.Visible = True
Me!lblOrgCo.Caption = "Organization"
If Me.fraIntExt = 0 Then
Me.ctCompanyName = "Agriculture and Agri-Food Canada"
End If
Else
If Me!fraIntExt Then
Me!lblIntExt.Caption = "External"
Me!lblOrgCo.Caption = "Company"
Else
Me!lblIntExt.Caption = "Internal"
Me!lblOrgCo.Caption = "Organization"
End If
Me!lblIntExt.Visible = True
Me!fraIntExt.Visible = False
End If
If Me!LcCountry = "Canada" Then
Me!LcPostalCode.InputMask = ">L0L\ 0L0"
Else
Me!LcPostalCode.InputMask = ""
End If
End Sub
---------------------------------------------------------------------------------------------
Private Sub fraIntExt_BeforeUpdate(Cancel As Integer)
If DCount("ContactID", "tblComteeCont", "ContactID = " &
Forms!frmCustomers!ContactID) > 0 Or DCount("ContactID", "tblExpCont",
"ContactID = " & Forms!frmCustomers!ContactID) > 0 Then
If MsgBox("By changing the customer's Internal/External designation
review all drop downs and Expertise and Committee selections." & vbCrLf &
"Do
you wish to continue?", vbYesNo, "Confirm") = vbNo Then
Cancel = 1
Me!fraIntExt.Undo
End If
End If
End Sub
---------------------------------------------------------------------------------------------
Private Sub fraIntExt_AfterUpdate()
Dim db As Database
Set db = CurrentDb
Me!cmbClass.Requery
Me!cmbOrg.Requery
If fraIntExt Then
'from Int to Ext
db.Execute "DELETE tblExpCont.*, tblCodes.cdInt, tblCodes.cdExt,
tblCodes.cdTitleNo, tblExpCont.ContactID " _
& "FROM tblExpCont INNER JOIN tblCodes ON tblExpCont.ExpertiseID =
tblCodes.cdValue " _
& "WHERE (((tblCodes.cdInt)=Yes) AND ((tblCodes.cdExt)=No) AND
((tblCodes.cdTitleNo)=17) AND ((tblExpCont.ContactID)= " &
[Forms]![frmCustomers]![ContactID] & "));"
db.Execute "DELETE tblComteeCont.*, tblCodes.cdInt, tblCodes.cdExt,
tblCodes.cdTitleNo, tblComteeCont.ContactID " _
& "FROM tblComteeCont INNER JOIN tblCodes ON
tblComteeCont.CommitteeID = tblCodes.cdValue " _
& "WHERE (((tblCodes.cdInt)=Yes) AND ((tblCodes.cdExt)=No) AND
((tblCodes.cdTitleNo)=16) AND ((tblComteeCont.ContactID)= " &
[Forms]![frmCustomers]![ContactID] & "));"
Me!lblOrgCo.Caption = "Company"
Me.[ctCompanyName] = ""
Else
'from Ext to Int
db.Execute "DELETE tblExpCont.*, tblCodes.cdInt, tblCodes.cdExt,
tblCodes.cdTitleNo, tblExpCont.ContactID " _
& "FROM tblExpCont INNER JOIN tblCodes ON tblExpCont.ExpertiseID =
tblCodes.cdValue " _
& "WHERE (((tblCodes.cdInt)=No) AND ((tblCodes.cdExt)=Yes) AND
((tblCodes.cdTitleNo)=17) AND ((tblExpCont.ContactID)= " &
[Forms]![frmCustomers]![ContactID] & "));"
db.Execute "DELETE tblComteeCont.*, tblCodes.cdInt, tblCodes.cdExt,
tblCodes.cdTitleNo, tblComteeCont.ContactID " _
& "FROM tblComteeCont INNER JOIN tblCodes ON
tblComteeCont.CommitteeID = tblCodes.cdValue " _
& "WHERE (((tblCodes.cdInt)=No) AND ((tblCodes.cdExt)=Yes) AND
((tblCodes.cdTitleNo)=16) AND ((tblComteeCont.ContactID)= " &
[Forms]![frmCustomers]![ContactID] & "));"
Me!lblOrgCo.Caption = "Organization"
Me.[ctCompanyName] = "Agriculture and Agri-Food Canada"
End If
---------------------------------------------------------------------------------------------
Private Sub cmbLcProvState_AfterUpdate()
Me!LcCountry = Me!cmbLcProvState.Column(2)
If Me!cmbLcProvState.Column(2) = "Canada" Then
Me!LcPostalCode.InputMask = ">L0L\ 0L0"
Else
Me!LcPostalCode.InputMask = ""
End If
End Sub
---------------------------------------------------------------------------------------------
Private Sub cmbLcProvState_DblClick(Cancel As Integer)
Me!cmbLcProvState.Undo
DoCmd.OpenForm "frmPrvStMgmt", , , , acFormAdd, , "cmbLcProvState"
End Sub
---------------------------------------------------------------------------------------------
Private Sub btnDone_Click()
On Error GoTo Err_btnDone_Click
DoCmd.RunCommand acCmdSaveRecord
If CustInCompl() Then
If OpenArgs = "New" Then
DoCmd.OpenForm "frmCustInc"
Exit Sub
End If
MsgBox "Contact Information is incomplete." & vbCrLf & "All areas
marked
in red need to be completed."
Exit Sub
End If
If OpenArgs = "New" Then
giNumber = Me!ctContactID
DoCmd.Close acForm, "frmCustomers"
DoCmd.Close acForm, "frmCustList"
gbFindRec = True
DoCmd.OpenForm "frmCustList"
DoCmd.GoToControl "ContID"
DoCmd.FindRecord giNumber
DoCmd.GoToControl "btnEdit"
Else
DoCmd.Close acForm, "frmCustomers"
If Not IsLoaded("frmCustList") Then
gbFindRec = True
DoCmd.OpenForm "frmCustList"
End If
'DoCmd.GoToControl "ContID"
Forms!frmCustList!ContID.SetFocus
DoCmd.FindRecord giNumber, acStart, False, , False, acCurrent, True
DoCmd.GoToControl "btnEdit"
End If
Exit_btnDone_Click:
Exit Sub
Err_btnDone_Click:
MsgBox Err.Description
Resume Exit_btnDone_Click
End Sub
---------------------------------------------------------------------------------------------
Private Sub btnCont_Click()
On Error GoTo Err_btnCont_Click
Dim db As Database
Dim rs As Recordset
Dim stDocName As String
Set db = CurrentDb
DoCmd.RunCommand acCmdSaveRecord
If CustInCompl() Then
If OpenArgs = "New" Then
DoCmd.OpenForm "frmCustInc"
Exit Sub
End If
If MsgBox("Contact Information is incomplete." & vbCrLf & "All areas
marked in red should be completed." & vbCrLf & "Select 'Cancel' to
complete
the Contact Information.", vbOKCancel, "Incomplete Contact Info") =
vbCancel
Then
Exit Sub
End If
End If
Set rs = db.OpenRecordset("SELECT tblServAreaName.*,
tblServAreaName.snInactive " _
& "FROM tblServAreaName " _
& "WHERE (((tblServAreaName.snInactive)=No));")
If rs.RecordCount = 0 Then
MsgBox "Please set up active service areas before making a contact."
Exit Sub
End If
DoCmd.Close acForm, "frmCustList"
Call CreateTmpContList
stDocName = "frmCustCare"
DoCmd.OpenForm stDocName, , , , , , Me!ContactID
DoCmd.Close acForm, "frmCustomers"
Exit_btnCont_Click:
Exit Sub
Err_btnCont_Click:
MsgBox Err.Description
Resume Exit_btnCont_Click
End Sub
8) The version of access being used is Access 2000.
Allen, I hope I have answered your questions and hope the details will aid
you in finding why the "overflow error" is displayed when the form is
opened.
Thanking you in advance for any help you can offer.
Allen Browne said:
FatMan, I doubt that approach will be productive. The form's Error
message
fires when there is an engine-level error. Even if it did manage to
suppress
the error message, it doesn't solve the engine-level problem. Kinda-like
unscrewing the warning light from the dashboard of your car: it doesn't
solve the problem.
You will need to track down what is causing this error:
Is this an attached table?
Or is the data imported and stored in Access?
Is the form based on a query?
Do you see the error when you open the table/query and scroll to the end?
Are there any calculated fields in the source query?
Are there any calculated controls on your form (i.e. the Control Source
starts with equals)?
Is there any other code in the form?
What version of Access is this?