Results 1 to 3 of 3
  1. #1
    motociap is offline Novice
    Windows 10 Access 2007
    Join Date
    May 2017
    Posts
    2

    Unhappy How to manage parametric SQL query answer

    Hi everyone,

    I am new in Access usage; I tried to use a parametric SQL query in VBA code and I want to use a field of the obtained result of the query:

    Do Until tKMWorksheet.EOF




    Set qCommessaDipendente = DBCOrrente.QueryDefs("CommessaDipendenteID")
    temp = tKMWorksheet.Fields("IDCommessaTrasferta")
    qCommessaDipendente.Parameters![NumeroCommessa:] = temp
    Set recsCommDipID = qCommessaDipendente.OpenRecordset
    strCommDipID = recsCommDipID.Fields("CommessaDipendenteID")
    ...



    Where am I wrong? The error says that there is not a current record...

    Many Thanks....

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Set recsCommDipID = qCommessaDipendente.OpenRecordset

    The syntax for this should be the same as your previous "Set" statement: Set recsCommDipID=DBCOrrente.Openrecordset("qCommessaD ipendente")

    Did you debug this code to see which line it is failing on?

  3. #3
    motociap is offline Novice
    Windows 10 Access 2007
    Join Date
    May 2017
    Posts
    2

    Solved

    Quote Originally Posted by aytee111 View Post
    Set recsCommDipID = qCommessaDipendente.OpenRecordset

    The syntax for this should be the same as your previous "Set" statement: Set recsCommDipID=DBCOrrente.Openrecordset("qCommessaD ipendente")

    Did you debug this code to see which line it is failing on?
    At the end there was a problem in the data... ... Anyway, many thanks for the quick answer!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 03-02-2016, 03:32 AM
  2. How to manage the manage the input of data?
    By Gambit17 in forum Import/Export Data
    Replies: 4
    Last Post: 07-30-2013, 10:32 AM
  3. Replies: 12
    Last Post: 06-25-2013, 12:52 PM
  4. Sum query returning incorrect answer
    By chawes40 in forum Queries
    Replies: 1
    Last Post: 12-11-2012, 03:52 PM
  5. Replies: 5
    Last Post: 04-24-2012, 10:26 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums