Insert SQL

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Insert SQL

Post by burrina »

What's wrong with my syntax?

Code: Select all

'Set Computer Name & Computer Login Name.
Dim ComputerLoginName As String
Dim Luser As String
    Dim sSQL   As String
ComputerLoginName = txtuserid
    Luser = ComputerLoginName

 

 sSQL = "INSERT INTO tblKey (Luser) VALUES & ('" & ComputerLoginName & "'))"
    If sSQL <> "" Then CurrentDb.Execute sSQL, dbFailOnError	'ERROR

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Insert SQL

Post by burrina »

Nevermind, I got it. Spoke to soon.
You do not have the required permissions to view the files attached to this post.

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Insert SQL

Post by burrina »

Dim pCoName As Property, pPresetReg As Property, pUserKeyInReg As Property, pUserKeyInCoName As Property
Dim db As DAO.Database

Set db = CurrentDb()
With db
'check to see if already defined
Set pCoName = .Properties("LKCompanyName")
Set pPresetReg = .Properties("LKPresetReg")
If pCoName.Value <> txtCompanyName Or pPresetReg.Value <> txtRegistrationCode Then
MsgBox "Invalid Registration Code. Please Contact the Developer.", vbExclamation
DoCmd.quit
Else
Set pUserKeyInReg = .Properties("LKUserKeyInReg")
pUserKeyInReg.Value = txtRegistrationCode

Set pUserKeyInCoName = .Properties("LKUserKeyInCompany")
pUserKeyInCoName.Value = txtCompanyName
MsgBox "You have successfully register this software", vbInformation
DoCmd.Close acForm, "frmRegister"
End If
End With
End Sub
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78232
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Insert SQL

Post by HansV »

I assume that you get an error message - what does it say?
Best wishes,
Hans

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Insert SQL

Post by burrina »

I abandoned this code Hans, it is too complicated for me. It is not my code so I am writing my own. I still have errors with some of it and will post back later.

Thanks,