Run-Time Error 3127 (1 Viewer)

poohbear2012

Registered User.
Local time
Today, 19:52
Joined
Jan 8, 2012
Messages
30
I am encountering a Run-Time Error 3127, when closing a form within my database the Run-Time error states:

"The INSERT INTO statement contains the following unknown field name: 'ref_GP_Name'. Make sure you have typed the name correctly and try the operation again"

I have checked the spelling of the field name and it is correct.

The coding that I have within the VBA for the form is:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Triaged = True Then
Dim db As Database
Set db = CurrentDb
db.Execute "INSERT INTO [tbldemochanges] " _
& "SELECT * FROM [tbldemography] " _
& "WHERE [tbldemography].[patient_id] =" & Me.patient_id & ";"
Set db = Nothing
Else
End If

End Sub

Any help in resolving this error would be gratefully appreciated.
 

RainLover

VIP From a land downunder
Local time
Tomorrow, 06:52
Joined
Jan 5, 2009
Messages
5,041
Why would you run a Statement like that.

If your Form was bound then there would be no need for such complications.

You don't even appear to mention the Field that you want to insert into.
 

RainLover

VIP From a land downunder
Local time
Tomorrow, 06:52
Joined
Jan 5, 2009
Messages
5,041
I have checked the spelling of the field name and it is correct.

How can you check the spelling. The field name mentioned in the error does not exist in your procedure.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 19:52
Joined
Sep 12, 2006
Messages
15,614
are you sure the field exists in tbldemochanges

maybe it has a hyphen in the field name instead of a underscore.
 

Users who are viewing this thread

Top Bottom