Ask Experts Questions for FREE Help !
Ask
    reidi_lexi's Avatar
    reidi_lexi Posts: 2, Reputation: 1
    New Member
     
    #1

    Nov 3, 2010, 04:44 AM
    Updating records and getting Runtime Error 3075
    Hello there!
    For the access program I am going to do, there is already an existing data. I had imported it from Excel. Now, I have created a URN field from the look up table and wanted to update it to the main table which comprises the existing data. I've used the following code but I keep on getting the Runtime Error 3075 message. Here is my code:

    Private Sub Command0_Click()
    Dim md As Recordset
    Dim phr As Recordset
    Dim entry As Recordset
    Dim phrname As String
    Dim mdname As String

    Set md = CurrentDb.OpenRecordset("tblMDinfo")
    Set phr = CurrentDb.OpenRecordset("tblPHRinfo")
    Set entry = CurrentDb.OpenRecordset("tblEntryTrack")
    phrname = phr("fldPHR")
    mdname = md("fldMDName")

    Do While entry.EOF = False
    CurrentDb.Execute "update tblEntryTrack set [tblEntryTrack].[fldPHRID] = [tblPHRinfo].[fldPHRID] where [tblEntryTrack].[fldPHR] = " & phrname & ";"
    CurrentDb.Execute "update tblEntryTrack set [tblEntryTrack].[fldMDID] = [tblMDinfo].[fldMDID] where [tblEntryTrack].[fldMDName] = " & mdname & ";"
    Loop
    MsgBox "done!"
    End Sub

    Help anyone?
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Nov 3, 2010, 07:37 AM

    First what is the full and Exact message you are getting. Second, What data types are fldPHR and fldMDName? Also what info is in them? Define URN field?

    And why do this in code? Why not just run an Update query?

    If I follow what you are doing, you added a Foreign key field to replace name as the FK, which is a good idea. But then all you need is to create an Update query, joined on the old FK and run it. No need for the looping code which has syntax errors.
    reidi_lexi's Avatar
    reidi_lexi Posts: 2, Reputation: 1
    New Member
     
    #3

    Nov 3, 2010, 10:01 PM
    That did give me an idea... It's okay now. Thanks!!
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #4

    Nov 4, 2010, 03:39 AM
    Quote Originally Posted by reidi_lexi View Post
    That did give me an idea...It's okay now. Thanks!!!
    Glad to help, how did you solve it?

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Runtime error [ 1 Answers ]

I bought a new Nikon L20 camera, but when I load the transfer software to my computer With WinXP and when I try to open it I get a runtime error C++ Library. Do you have a cure for this problem. Thanks for any help, Ed Hood...

Runtime error 53 [ 2 Answers ]

I use topdownloads folder lock 5.0 to protect my sensitive docs but I can't open the folder I'm protecting I keep getting - runtime error 53 file not found - I uninstalled the prog but still can't open the folder, why is this? I've tried it on other folders with no probs. I need to get into this...

Trouble Updating Records Individually [ 3 Answers ]

I'm trying to update a table in Microsoft Access with the following SQL: UPDATE tblLastLDAP, tblGenex1 SET tblGenex1.SURROGATEID = Left(!,6) & Int((99-1+1)*Rnd()+1); I want the records to each be set to a number between 1 and 99 (+ the beginning info), but the result of the SQL above sets all...

Runtime error [ 2 Answers ]

Hi everyone I received this email from my sister I can`t help can anyone ? Thanks very much, Lynn "stef has a runtime error when she opens up her comp and it won't let her on to the net so can't get her to download anything to sort it out, got any ideas, she has tried system restore but it...


View more questions Search