Minggu, 25 November 2012

RE: [MS_AccessPros] Problem referencing values in query

 

Hi Rod

Is it possible that one or both of these fields have a Caption property
different from its field name, so that the header in the table/query shows
one thing, but the field name is different?

Your code should refer to the field names, not the captions. This is one
reason why captions are often considered a bad idea.

-- Graham [Access MVP 1996-2012]

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of rodbevill
Sent: Monday, 26 November 2012 13:08
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Problem referencing values in query

Hi all,
I am having a problem retrieving values from a query. I am using Access 2010
on Windows 7. The following is the code where the issue exist. The issue is
the MsgBox in the DO WHILE loop. After the record set is open ONE record
exist. However, when trying to display a couple of the values an error is
generated indicating the information does not exist. "Error 3265, Item not
found in this collection." When the query is run standalone the field names
appear with the appropriate data.
Any suggestions, I will continue to research the issue. Thank you for your
time.
Rod
------------------------------------
Private Sub Process_XL_Records()
Dim rst As DAO.Recordset
Dim tmpStr As String

'Set some local parameters for queries

Set rst =
CurrentDb.OpenRecordset("New_License_Without_Matching_tblTaxpayer")
MsgBox "Record count = " & rst.RecordCount

rst.MoveFirst
Do While Not rst.EOF

MsgBox rst![LICENSE DT] & " - " & rst![LOCATION STREET]
tmpStr = ""

rst.MoveNext
Loop
rst.Close
Set rst = Nothing 'Deassign all objects.
End Sub

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar