Access 2013 Edit Form error 3021 - ms-access

So I've got the code below (not all of it is grey for some reason)
Private Sub CmdEdit_Click()
Me.Tableinform.Requery
Dim rs As DAO.Recordset
Set rs = Me.Tableinform.Form.RecordsetClone
'get data to textbox control
With rs
If .RecordCount > 0 Then
With Me.Tableinform.Form.Recordset
Me.ShowIDbox = .Fields("[ID]").Value
Me.CompbyDD = .Fields("[Received By]")
Me.Date1 = .Fields("[Date Received]")
Me.Date2 = .Fields("[Date Processed]")
Me.ReqType = .Fields("[Request Type]")
Me.InsName = .Fields("[Insured Name]")
Me.RiskNo = .Fields("[Risk Number]")
Me.EndtRef = .Fields("[Endorsement Reference]")
Me.EOCNo = .Fields("[EOC Number]")
Me.Tech = .Fields("[Technician]")
Me.BillIns = .Fields("[Billing Instructions]")
Me.Addrecord.Caption = "Update"
Me.CmdEdit.Enabled = False
Me.cmdDuplicate.Enabled = True
Me.CmdDelete.Enabled = True
End With
End If
End With
End Sub
After one Edit and Update, the edit function throws out Error '3021' No Current Record?
Please show me where I am going wrong with this.
Add/Update button as follows:
If Me.ShowIDbox.Value = "" Then
CurrentDb.Execute "INSERT INTO fmdatatable( [Received By], [Date Received], [Date Processed], [Request Type], [Insured Name], [Risk Number], [Endorsement Reference], [EOC Number], [Technician], [Billing Instructions]) " & _
" VALUES ('" & Me.CompbyDD & "','" & Me.Date1 & "','" & Me.Date2 & "','" & Me.ReqType & "','" & Me.InsName & "','" & Me.RiskNo & "','" & Me.EndtRef & "','" & Me.EOCNo & "','" & Me.Tech & "','" & Me.BillIns & "')"
Else
CurrentDb.Execute "UPDATE fmdatatable SET [Received By]='" & Me.CompbyDD & "'" & _
", [Date Received]='" & Me.Date1 & "'" & _
", [Date Processed]='" & Me.Date2 & "'" & _
", [Request Type]='" & Me.ReqType & "'" & _
", [Insured Name]='" & Me.InsName & "'" & _
", [Risk Number]='" & Me.RiskNo & "'" & _
", [Endorsement Reference]='" & Me.EndtRef & "'" & _
", [EOC Number]='" & Me.EOCNo & "'" & _
", [Technician]='" & Me.Tech & "'" & _
", [Billing Instructions]='" & BillIns & "'" & _
" WHERE [ID]=" & Me.ShowIDbox.Value
End If
Me.CompbyDD = "-Please Select-"
Me.Date1 = ""
Me.Date2 = ""
Me.ReqType = "-Please Select-"
Me.InsName = ""
Me.RiskNo = ""
Me.EndtRef = ""
Me.EOCNo = ""
Me.Tech = ""
Me.BillIns = "-Please Select-"
Me.ShowIDbox = ""
Me.Addrecord.Caption = "Add Record"
Me.CmdEdit.Enabled = True
Me.cmdDuplicate.Enabled = False
Me.CmdDelete.Enabled = False
Tableinform.Form.Requery
This edit works once, then all subsequent later edits are throwing errors out.

Related

How to save edited data record in access form as a new record?

I am facing a little issue now. My issue is that currently when i made edit to the current record in my subform and click on "update" it will overwrite my previous record which i do not want.
Instead, I would like to add my edited data record from the subform and insert it into the subform as a new record with the same PO number as the one that i am editing.
Below are my code:
Private Sub cmdAdd_Click()
'when we click on button Add there are two options
'1. for insert
'2. for update
If Me.txtID.Tag & "" = "" Then
'this is for insert new
'add data to table
CurrentDb.Execute "INSERT INTO mxd " & _
"(ID,Fabrication,Width,FinishedGoods,Colour, " & _
"LabDipCode,GrossWeight,NettWeight, " & _
"Lbs,Loss,Yds,Remarks,POType,ComboName,GroundColour)" & _
" VALUES(" & Me.txtID & ",'" & Me.txtFabrication & "','" & _
Me.txtWidth & "','" & Me.txtFinishedGood & "','" & _
Me.txtColour & "','" & Me.txtLabDipCode & "','" & _
Me.txtGrossweight & "','" & _ Me.txtNettweight & "','" & _
Me.txtLbs & "','" & Me.txtLoss & "','" & _ Me.txtYds & "','" & _
Me.txtRemarks & "','" & Me.cboPoType "','" & _
Me.txtGroundColour & "','" & Me.txtComboName & "')"
Else
'otherwise (Tag of txtID store the id of student to be modified)
CurrentDb.Execute "UPDATE mxd " & _
" SET ID = " & Me.txtID & _
", Fabrication = '" & Me.txtFabrication & "'" & _
", Width = '" & Me.txtWidth & "'" & _
", FinishedGoods = '" & Me.txtFinishedGood & "'" & _
", Colour = '" & Me.txtColour & "'" & _
", LabDipCode = '" & Me.txtLabDipCode & "'" & _
", GrossWeight = '" & Me.txtGrossweight & "'" & _
", NettWeight = '" & Me.txtNettweight & "'" & _
", LBS = '" & Me.txtLbs & "'" & _
", Loss = '" & Me.txtLoss & "'" & _
", Yds = '" & Me.txtYds & "'" & _
", Remarks = '" & Me.txtRemarks & "'" & _
", POType = '" & Me.cboPoType & "'" & _
", ComboName = '" & Me.txtComboName & "'" & _
", GroundColour = '" & Me.txtGroundColour & "'" & _
" WHERE ID = " & Me.txtID.Tag
End If
'clear form
cmdClear_Click
'refresh data in list on form
FormMxdSub.Form.Requery
End Sub
Private Sub cmdClear_Click()
Me.txtID = ""
Me.txtFabrication = ""
Me.txtWidth = ""
Me.txtFinishedGood = ""
Me.txtColour = ""
Me.txtLabDipCode = ""
Me.txtGrossweight = ""
Me.txtNettweight = ""
Me.txtLbs = ""
Me.txtLoss = ""
Me.txtYds = ""
Me.txtRemarks = ""
Me.cboPoType = ""
Me.txtKeywords = ""
Me.txtComboName = ""
Me.txtGroundColour = ""
'focus on ID text box
Me.txtID.SetFocus
'set button edit to enable
Me.cmdEdit.Enabled = True
'change caption of button add to Add
Me.cmdAdd.Caption = "Add"
'clear tag on txtID for reset new
Me.txtID.Tag = ""
End Sub
Private Sub cmdClose_Click()
DoCmd.Close
End Sub
Private Sub cmdDelete_Click()
'delete record
'check existing selected record
If Not (Me.FormMxdSub.Form.Recordset.EOF And
Me.FormMxdSub.Form.Recordset.BOF) Then
'confirm delete
If MsgBox("Are you sure you want to delete?", vbYesNo) = vbYes Then
'delete now
CurrentDb.Execute "DELETE FROM mxd " & _
"where ID = " & Me.FormMxdSub.Form.Recordset.Fields("ID")
'refresh data in list
Me.FormMxdSub.Form.Requery
End If
End If
End Sub
Private Sub cmdEdit_Click()
'check whether there is exists data in list
If Not (Me.FormMxdSub.Form.Recordset.EOF And
Me.FormMxdSub.Form.Recordset.BOF) Then
'get data to text box control
With Me.FormMxdSub.Form.Recordset
Me.txtID = .Fields("ID")
Me.txtFabrication = .Fields("Fabrication")
Me.txtWidth = .Fields("Width")
Me.txtFinishedGood = .Fields("FinishedGoods")
Me.txtColour = .Fields("Colour")
Me.txtLabDipCode = .Fields("LabDipCode")
Me.txtGrossweight = .Fields("GrossWeight")
Me.txtNettweight = .Fields("NettWeight")
Me.txtLbs = .Fields("Lbs")
Me.txtLoss = .Fields("Loss")
Me.txtYds = .Fields("Yds")
Me.txtRemarks = .Fields("Remarks")
Me.cboPoType = .Fields("POType")
Me.txtComboName = .Fields("ComboName")
Me.txtGroundColour = .Fields("GroundColour")
'store id of student in Tag of txtID in case id is modified
Me.txtID.Tag = .Fields("ID")
'change caption of button add to update
'Me.cmdAdd.Caption = "Update"
'disable button edit
Me.cmdEdit.Enabled = False
End With
End If
End Sub
You can use the RecordsetClone to create a dupe of the current record. Much faster and cleaner and no Tag is needed:
Private Sub btnCopy_Click()
Dim rstSource As DAO.Recordset
Dim rstInsert As DAO.Recordset
Dim fld As DAO.Field
If Me.NewRecord = True Then Exit Sub
Set rstInsert = Me.RecordsetClone
Set rstSource = rstInsert.Clone
With rstSource
If .RecordCount > 0 Then
' Go to the current record.
.Bookmark = Me.Bookmark
With rstInsert
.AddNew
For Each fld In rstSource.Fields
With fld
If .Attributes And dbAutoIncrField Then
' Skip Autonumber or GUID field.
ElseIf .Name = "SomeFieldToExclude" Then
' Leave field blank.
ElseIf .Name = "SomeOtherFieldToExclude" Then
' Leave field blank.
Else
' Copy field content.
rstInsert.Fields(.Name).Value = .Value
End If
End With
Next
.Update
' Go to the new record and sync form.
.MoveLast
Me.Bookmark = .Bookmark
.Close
End With
End If
.Close
End With
Set rstInsert = Nothing
Set rstSource = Nothing
End Sub
Of course, if you place the button on the main form, replace in the code Me with a reference to the subform: Me!NameOfYourSubformControl.Form

How I can update attachments and file path?

I have created a table where I'm saving attachments(in external folder) and file paths in the table. When I'm trying to update existing attachment with another, it does not work. Please see below "Add file" code and "Update button" code.
Private Sub cmAdd_Click()
On Error Resume Next
Dim strLokacioni As String
Dim strSQL As String
strLokacioni = "C:\Users\HSE\Desktop\datas\" & getFileName(Me.path.Value)
strSQL = "INSERT INTO tbl_tracker(path, filename, IncNo, PATS, SAP, First, Last, IncDate, Description, Location, OshaType, IncType, RootCause,Inspector, Surfaces, WeatherCon, WorkRelated, IncTime)" & _
"VALUES ( '" & strLokacioni & "', '" & Me.path.Value & "', '" & Me.txtInc & "', '" & Me.txtPATS & "', '" & Me.txtSAP & "', '" & Me.txtFirst & "', '" & Me.txtLast & "', '" & Me.txtDate & "', '" & Me.txtDesc & "', '" & Me.cmbLoc & "', '" & Me.cmbOsha & "', '" & Me.cmbType & "', '" & Me.txtCause & "', '" & Me.cmbInsp & "', '" & Me.cmbSur & "', '" & Me.cmbWcon & "', '" & Me.cmbRelated & "', '" & Me.txtTime & "')"
CurrentDb.Execute (strSQL)
MsgBox "Record Added", vbInformation, "Information"
Dim fso As Object
Set fso = VBA.CreateObject("Scripting.FileSystemObject")
fso.CopyFile Me.path.Value, strLokacioni
Set fso = Nothing
Me.tbl_tracker_subform.Form.Requery
End Sub
' Below is update button code
Private Sub Command88_Click()
'On Error Resume Next
Dim strLokacioni As String: strLokacioni = "C:\Users\HSE\Desktop\datas\" & getFileName(Me.path.Value)
Me.path = strLokacioni
CurrentDb.Execute "UPDATE tbl_tracker " & _
" SET IncNo = " & Me.txtInc & _
", path = '" & strLokacioni & "'" & _
", filename = '" & Me.filename & "'" & _
", PATS = '" & Me.txtPATS & "'" & _
", SAP = '" & Me.txtSAP & "'" & _
", First = '" & Me.txtFirst & "'" & _
", Last = '" & Me.txtLast & "'" & _
", IncDate = '" & Me.txtDate & "'" & _
", Location = '" & Me.cmbLoc & "'" & _
", Description = '" & Me.txtDesc & "'" & _
", OshaType = '" & Me.cmbOsha & "'" & _
", Inctype = '" & Me.cmbType & "'" & _
", RootCause = '" & Me.txtCause & "'" & _
", Inspector = '" & Me.cmbInsp & "'" & _
", Surfaces = '" & Me.cmbSur & "'" & _
", WeatherCon = '" & Me.cmbWcon & "'" & _
", WorkRelated = '" & Me.cmbRelated & "'" & _
", IncTime = '" & Me.txtTime & "'" & _
" WHERE IncNo = " & Me.txtInc.Tag
Dim fso As Object
Set fso = VBA.CreateObject("Scripting.FileSystemObject")
fso.CopyFile Me.path.Value, strLokacioni
Set fso = Nothing
MsgBox "Record Updated", vbInformation, "Information"
Me.tbl_tracker_subform.Form.Requery
End sub
And the the value Me.path.Value at the start of Command88_click is coming from :
Public Function getFileName(ByVal strPath As String) As String
If Right$(strPath, 1) <> "\" And Len(strPath) > 0 Then
getFileName = getFileName(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
End If
End Function
Private Sub cbdBrowse_Click()
On Error Resume Next
Dim f As Object
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.AllowMultiSelect = False
f.Show
Me.path.Value = f.SelectedItems(1)
End Sub
When I use update queries like you have here, I would always use the following syntax.
dim db as database
set db = currentDb
db.execute "UPDATE...."
would you require the same? Or have I been going about this a long way.
Also, I would have left a comment as this may not be the answer. Unfortunately, I cant due to rep<50

I'm trying to UPDATE my table in Access VBA

If Me.dcBox & "" = "" Then
CurrentDb.Execute "UPDATE worklogData " & _
" SET [Submitter] = '" & Me.subBox & "'" & _
", [Section] = '" & Me.secBox & "'" & _
", [Received By] = '" & Me.rbBox & "'" & _
", [Date Received] = """ & _
", [Serial Number] = '" & Me.snBox & "'" & _
", [Problem] = '" & Me.probBox & "'" & _
", [Computer Name] = '" & Me.cnBox & "'" & _
", [MAC] = '" & Me.macBox & "'" & _
", [Solution] = '" & Me.solBox & "'" & _
", [Completed By] = '" & Me.cbBox & "'" & _
", [Date Completed] = """ & _
" WHERE [Order] = " & Me.orderBox.Tag & ""
Else
CurrentDb.Execute "UPDATE worklogData " & _
" SET [Submitter] = '" & Me.subBox & "'" & _
", [Section] = '" & Me.secBox & "'" & _
", [Received By] = '" & Me.rbBox & "'" & _
", [Date Received] = #" & Me.drBox & "#" & _
", [Serial Number] = '" & Me.snBox & "'" & _
", [Problem] = '" & Me.probBox & "'" & _
", [Computer Name] = '" & Me.cnBox & "'" & _
", [MAC] = '" & Me.macBox & "'" & _
", [Solution] = '" & Me.solBox & "'" & _
", [Completed By] = '" & Me.cbBox & "'" & _
", [Date Completed] = #" & Me.dcBox & "#" & _
" WHERE [Order] = " & Me.orderBox.Tag & ""
End If
I'm trying to UPDATE my table in Access VBA, but I found it causes Runtime Error: 3075 'Syntax error in date in query expression '#' when I try to UPDATE [Date Completed] field from what was blank previously.
And I've set Me.probBox as some text value which was previously blank, but [Problem] field doesn't be updated. What is surprising is there is no error coming out for this one.
Try this
CurrentDb.Execute "UPDATE worklogData " & _
" SET [Submitter] = '" & Me.subBox & "'" & _
", [Section] = '" & Me.secBox & "'" & _
", [Received By] = '" & Me.rbBox & "'" & _
", [Date Received] = """"" & _
", [Serial Number] = '" & Me.snBox & "'" & _
", [Problem] = '" & Me.probBox & "'" & _
", [Computer Name] = '" & Me.cnBox & "'" & _
", [MAC] = '" & Me.macBox & "'" & _
", [Solution] = '" & Me.solBox & "'" & _
", [Completed By] = '" & Me.cbBox & "'" & _
", [Date Completed] = """"" & _
" WHERE [Order] = " & Me.orderBox.Tag & ""

Argument is not optional?

Private Sub cmdAdd_Click()
'add data to table
CurrentDb.Execute = "INSERT INTO jscbb_dir2(ID,Lastname,FirstName, PrimA, Artea,LubNum,OfficeNum,OfficePhone,Email,LabPhone,stats)" & _
" VALUES(" & Me.Textid & ",'" & Me.TextLast & "','" & Me.TextFirst & "','" & Me.Textprima & "','" & Me.Textarea & "','" & Me.Textlabnum & _
"','" & Me.Textofficenum & "','" & Me.Textofficephone & "','" & Me.Textemail & "','" & Me.Textlabphone & "','" & Me.Textstatus & "')"
'refresh data is list on focus
jscbb_dirsub.Form.Requery
End Sub
Why am I getting an error on the last (Me.Textstatus)? I know this is a low-level question, but I need another pair of eyes, I've been looking at this for over an hour. The error is "Compile Error: Argument Not Optional"
Consider parameters, they will be easier to debug.
Dim qdf As QueryDef
ssql = "INSERT INTO jscbb_dir2(ID,Lastname,FirstName,PrimA,Artea," _
& "LubNum,OfficeNum,OfficePhone,Email,LabPhone,stats) " _
& "VALUES([id],[last],[first],[prima],[area],[lab]," _
& "[office],[phone],[email],[stat])"
Set qdf = CurrentDb.CreateQueryDef("", ssql)
qdf.Parameters("id") = Me.TextID
qdf.Parameters("last") = Me.Textlast
qdf.Parameters("first") = Me.Textfirst
qdf.Parameters("prima") = Me.Textprima
qdf.Parameters("area") = Me.Textarea
qdf.Parameters("lab") = Me.Textlabnum
qdf.Parameters("office") = Me.Textofficenumbet
qdf.Parameters("phone") = Me.Textofficephone
qdf.Parameters("email") = Me.Textemail
qdf.Parameters("stat") = Me.Textstatus
qdf.Execute dbFailOnError
Execute is a method, not a property. You don't use = between a method and its arguments, so
CurrentDb.Execute = "..."
should be
CurrentDb.Execute "..."

Access Database not inserting records

Solved: i just managed to solve the problem by creating a new table and removing [IT-DEC], [IT-DEC-MAKER-FNAME], [IT-DEC-MAKER-LNAME] where i replaced them by strings accepted by access such as ITDECMAKER ITDECMAKEFNAME ITDECMAKERLNAME
Looks like the problem is solved, however if anyone has a theory to why this has happened id really appreciate your contribution
thank you
I am facing trouble with inserting more than one line of data into my table. For example i load my form and input the data into textbox all information are inserted into their respective tables accordingly, however for the second time when i want to insert data, all data are inserted succesffuly in their respective tables except for one table which is not taking any more data thus only allowing for one line of data.
This is the code i am using in the same form
This part of code is responsible for the userinfo table which is not accepting more than one record
Private Sub proceedBTN_Click()
GlobalVar.flp = Me.qfirstname + Me.qlastname + Me.qmobile
CurrentDb.Execute "INSERT INTO UserInfo(" _
& "FLP, FirstName, LastName, Company, JobTitle, PhoneNumber, Mobile, Email, Fax, " _
& "[IT-DEC], [IT-DEC-MAKER-FNAME], [IT-DEC-MAKER-LNAME], Contact, ContactMethodPhone, " _
& "ContactMethodEmail, ContactMethodFax, ContactMethodPostal , AcquisitionTimeFrame, Budget ) " _
& "VALUES('" & GlobalVar.flp & "','" & Me.qfirstname & "','" & Me.qlastname & "','" & Me.qcompany & "','" & Me.qjob & "','" & Me.qphone & "','" & Me.qmobile & "','" & Me.qemail & "','" _
& Me.qfax & "','" & Me.itdecopt & "','" & Me.qitfirstname & "','" & Me.qitlastname & "','" & Me.contactoption & "','" _
& Me.contactphoneopt & "','" & Me.contactemailopt & "','" & Me.contactfaxopt & "','" & Me.contactpostalopt & "','" & Me.acquisitionoption & "','" & Me.budgetoption & "');"
This Code is responsible for inserting into the UserPartners table which allows succesffuly entering multiple records.
CurrentDb.Execute "INSERT INTO UserPartners(" _
& "FLP, PartnerACT, PartnerBMB, PartnerEverTeam, " _
& "PartnerFormatech, PartnerICC, PartnerIBS, PartnerMegaTek, PartnerMDS, PartnerProcomix, PartnerSetsSolutions, " _
& "PartnerTripleC, PartnerNewHorizons, PartnerPromethean, PartnerTeletrade, PartnerNokia, PartnerPolycom, PartnerDell ) " _
& "VALUES('" & GlobalVar.flp & "','" & Me.partneract & "','" & Me.partnerbmb & "','" _
& Me.partnereverteam & "','" & Me.partnerformatech & "','" & Me.partnericc & "','" & Me.partneribs & "','" & Me.partnermegatek & "','" & Me.partnermds & "','" _
& Me.partnerprocomix & "','" & Me.partnersetssolutions & "','" & Me.partnertriplec & "','" & Me.partnernewhorizons & "','" & Me.partnerpromethean & "','" _
& Me.partnerteletrade & "','" & Me.partnernokia & "','" & Me.partnerpolycom & "','" & Me.partnerdell & "');"
Finally this is the code for the whole form
Option Compare Database
Private Sub contactoption_Click()
If Me.contactoption.Value = 2 Then
Me.contactemailopt.Enabled = False
Me.contactfaxopt.Enabled = False
Me.contactphoneopt.Enabled = False
Me.contactpostalopt.Enabled = False
Me.partneract.Enabled = False
Me.partnerbmb.Enabled = False
Me.partnerdell.Enabled = False
Me.partneredm.Enabled = False
Me.partnereverteam.Enabled = False
Me.partnerformatech.Enabled = False
Me.partneribs.Enabled = False
Me.partnericc.Enabled = False
Me.partnermds.Enabled = False
Me.partnermegatek.Enabled = False
Me.partnernewhorizons.Enabled = False
Me.partnernokia.Enabled = False
Me.partnerpolycom.Enabled = False
Me.partnerprocomix.Enabled = False
Me.partnerpromethean.Enabled = False
Me.partnersetssolutions.Enabled = False
Me.partnerteletrade.Enabled = False
Me.partnertriplec.Enabled = False
Else: Me.contactemailopt.Enabled = True
Me.contactfaxopt.Enabled = True
Me.contactphoneopt.Enabled = True
Me.contactpostalopt.Enabled = True
Me.partneract.Enabled = True
Me.partnerbmb.Enabled = True
Me.partnerdell.Enabled = True
Me.partneredm.Enabled = True
Me.partnereverteam.Enabled = True
Me.partnerformatech.Enabled = True
Me.partneribs.Enabled = True
Me.partnericc.Enabled = True
Me.partnermds.Enabled = True
Me.partnermegatek.Enabled = True
Me.partnernewhorizons.Enabled = True
Me.partnernokia.Enabled = True
Me.partnerpolycom.Enabled = True
Me.partnerprocomix.Enabled = True
Me.partnerpromethean.Enabled = True
Me.partnersetssolutions.Enabled = True
Me.partnerteletrade.Enabled = True
Me.partnertriplec.Enabled = True
End If
End Sub
Private Sub itdecopt_Click()
If Me.itdecopt.Value = 1 Then
Me.qitfirstname.Enabled = False
Me.qitlastname.Enabled = False
Else: Me.qitfirstname.Enabled = True
Me.qitlastname.Enabled = True
End If
End Sub
Private Sub proceedBTN_Click()
GlobalVar.flp = Me.qfirstname + Me.qlastname + Me.qmobile
CurrentDb.Execute "INSERT INTO UserInfo(" _
& "FLP, FirstName, LastName, Company, JobTitle, PhoneNumber, Mobile, Email, Fax, " _
& "[IT-DEC], [IT-DEC-MAKER-FNAME], [IT-DEC-MAKER-LNAME], Contact, ContactMethodPhone, " _
& "ContactMethodEmail, ContactMethodFax, ContactMethodPostal , AcquisitionTimeFrame, Budget ) " _
& "VALUES('" & GlobalVar.flp & "','" & Me.qfirstname & "','" & Me.qlastname & "','" & Me.qcompany & "','" & Me.qjob & "','" & Me.qphone & "','" & Me.qmobile & "','" & Me.qemail & "','" _
& Me.qfax & "','" & Me.itdecopt & "','" & Me.qitfirstname & "','" & Me.qitlastname & "','" & Me.contactoption & "','" _
& Me.contactphoneopt & "','" & Me.contactemailopt & "','" & Me.contactfaxopt & "','" & Me.contactpostalopt & "','" & Me.acquisitionoption & "','" & Me.budgetoption & "');"
CurrentDb.Execute "INSERT INTO UserPartners(" _
& "FLP, PartnerACT, PartnerBMB, PartnerEverTeam, " _
& "PartnerFormatech, PartnerICC, PartnerIBS, PartnerMegaTek, PartnerMDS, PartnerProcomix, PartnerSetsSolutions, " _
& "PartnerTripleC, PartnerNewHorizons, PartnerPromethean, PartnerTeletrade, PartnerNokia, PartnerPolycom, PartnerDell ) " _
& "VALUES('" & GlobalVar.flp & "','" & Me.partneract & "','" & Me.partnerbmb & "','" _
& Me.partnereverteam & "','" & Me.partnerformatech & "','" & Me.partnericc & "','" & Me.partneribs & "','" & Me.partnermegatek & "','" & Me.partnermds & "','" _
& Me.partnerprocomix & "','" & Me.partnersetssolutions & "','" & Me.partnertriplec & "','" & Me.partnernewhorizons & "','" & Me.partnerpromethean & "','" _
& Me.partnerteletrade & "','" & Me.partnernokia & "','" & Me.partnerpolycom & "','" & Me.partnerdell & "');"
CurrentDb.Execute "INSERT INTO UserProducts(" _
& "FLP, ProductsExchange,ProductsLyncServer, ProductsLync , ProductsOffice, ProductsSharePoint, ProductsSharePointInternet, ProductsWindowsServer, " _
& "ProductsSystemCenter, ProductsSQL, ProductsWindows7 ) " _
& "VALUES('" & GlobalVar.flp & "','" & Me.productexchange & "','" & Me.productlyncserver & "','" _
& Me.productlync & "','" & Me.productoffice & "','" & Me.productsharepoint & "','" & Me.productsharepointinternet & "','" & Me.productserver & "','" & Me.productsystemcenter & "','" _
& Me.productsql & "','" & Me.productwindows & "');"
DoCmd.OpenForm "DayChoose", acNormal
DoCmd.Close acForm, "UserInfo", acSaveYes
End Sub
Before I can help you, please rework using parameters as follows:
Private Sub proceedBTN_Click()
Dim Db As DAO.Database
Set Db = CurrentDb
Dim qd As DAO.QueryDef
Dim SQL As String
SQL = "INSERT INTO UserInfo(" & _
"FLP, FirstName, LastName, Company, JobTitle, PhoneNumber, Mobile, Email, Fax, " & _
"[IT-DEC], [IT-DEC-MAKER-FNAME], [IT-DEC-MAKER-LNAME], Contact, ContactMethodPhone, " & _
"ContactMethodEmail, ContactMethodFax, ContactMethodPostal , AcquisitionTimeFrame, Budget) " & _
"VALUES([pflp], [pfirstname], [pqlastname], [pqcompany],[pqjob],[pqphone],[pqmobile], [pqemail]," & _
"[pqfax],[pitdecopt],pqitfirstname,[pqitlastname],[pcontactoption],[pcontactphoneopt],[pcontactemailopt]," & _
"[pcontactfaxopt],[pcontactpostalopt],[pacquisitionoption],[pbudgetoption]);"
Set qd = Db.CreateQueryDef("", SQL)
qd.Parameters("pflp") = GlobalVar.flp
qd.Parameters("pfirstname") = Me.qfirstname
' continue filling parameters....
qd.Parameters("pbudgetoption").Value = Me.budgetoption
qd.Execute
End Sub
If this does not resolve your issue, we can dig a little deeper.