3061 Error

A

Andy Dorph

I cannot get the following to run wiuthout receiving an error message. I
have other queries exactly the same that work just fine in other forms.

I have read the other postings and ensured that the table field names and
form field names are correct.

When I copy it to SQL view and run it by clicking on the datasheet view, I
am asked for V_ID

Thanks in advance.

FYI: When I msgBox the query string it comes out just as I want it to
format. It is:

SELECT [V_Address1] FROM Vendor WHERE [V_ID] = 17

For the following, lstName is the name of a a ListBox

Dim GetVendorQuery As String
Dim rs As DAO.Recordset
intTO = lstName.Value

GetVendorQuery = "SELECT [V_Address1] FROM Vendor WHERE [V_ID] = " & intTO
Set rs = CurrentDb().OpenRecordset(GetVendorQuery)

If Not rs.BOF And Not rs.EOF Then
txtAddress1.Value = rs![V_Address1]
Else
MsgBox "No matching record. Please contact your Database
Administrator."
DoCmd.Close
End If

rs.Close
Set rs = Nothing
 
A

Andi Mayer

I cannot get the following to run wiuthout receiving an error message. I
have other queries exactly the same that work just fine in other forms.

I have read the other postings and ensured that the table field names and
form field names are correct.

When I copy it to SQL view and run it by clicking on the datasheet view, I
am asked for V_ID
Why not go to the "Query Design" and look why the field is missing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top