S
Steve Jensen
I have an ADP, parts of which go back to 1995. Recently I recompiled it
after making minor changes to a form, and after opening the code window and
saving the changes, a function that had previously worked for years stopped
working.
The function loops through fields in a querydef and sets the name and
recordsource of fields on a form to the fields in the querydef. The code is:
Dim i As Integer, rsQBF As ADODB.Recordset, intFieldCount As Integer
Dim frmPreviewForm As Form, fldPreview As Field, intRetval As Integer
Dim mqdf as QueryDef
For i = 0 To intFieldCount - 1
Set fldPreview = mqdf.Fields(i)
frmPreviewForm!SQLResults.Form("label" & (i + 1)).Caption =
fldPreview.Name
frmPreviewForm!SQLResults.Form("txtField" & (i + 1)).ControlSource =
fldPreview.Name
Next
the Set flePreview = mqdf.Fields(i) throws an error 13, which it has never
done before.
In order to correct the problem, I had to rem out this line and change the
next 2 lines as follows:
frmPreviewForm!SQLResults.Form("label" & (i + 1)).Caption =
mqdf.Fields(i).Name
frmPreviewForm!SQLResults.Form("txtField" & (i + 1)).ControlSource =
mqdf.Fields(i).Name
Since nothing other than automatic updates have been installed on my
development computer, I can only assume this is the result of one of them.
Any other ideas?
after making minor changes to a form, and after opening the code window and
saving the changes, a function that had previously worked for years stopped
working.
The function loops through fields in a querydef and sets the name and
recordsource of fields on a form to the fields in the querydef. The code is:
Dim i As Integer, rsQBF As ADODB.Recordset, intFieldCount As Integer
Dim frmPreviewForm As Form, fldPreview As Field, intRetval As Integer
Dim mqdf as QueryDef
For i = 0 To intFieldCount - 1
Set fldPreview = mqdf.Fields(i)
frmPreviewForm!SQLResults.Form("label" & (i + 1)).Caption =
fldPreview.Name
frmPreviewForm!SQLResults.Form("txtField" & (i + 1)).ControlSource =
fldPreview.Name
Next
the Set flePreview = mqdf.Fields(i) throws an error 13, which it has never
done before.
In order to correct the problem, I had to rem out this line and change the
next 2 lines as follows:
frmPreviewForm!SQLResults.Form("label" & (i + 1)).Caption =
mqdf.Fields(i).Name
frmPreviewForm!SQLResults.Form("txtField" & (i + 1)).ControlSource =
mqdf.Fields(i).Name
Since nothing other than automatic updates have been installed on my
development computer, I can only assume this is the result of one of them.
Any other ideas?