I need to create a new form in order to add new City, St and Zip to a pre-existing ZipCode table. The front end is Access and the backend is SQL.
I was looking at other form and there is code that shows it is adding the new data directly into the sql table.
Actual code:
Do I have to include this type of code for my Zip Code form?
The Zip table only has City, St, Zip fields, so I would think it can't be too difficult to figure this out.
If so, I think I can figure it out, but can someone tell me what the # means?
I was looking at other form and there is code that shows it is adding the new data directly into the sql table.
Actual code:
Code:
Private Sub btnAdd_Click()
Dim strAddSQL As String
Dim strNewCode As String
Dim datCurrentDate As Date
Dim datCurrentTime As Date
strNewCode = CheckQuotes(txtNewCode)
strPrompt = "Do you want to add the following code " & vbCrLf & _
Chr(9) & "'" & strNewCode & "'"
intUserResponse = MsgBox(strPrompt, vbYesNo)
If intUserResponse = vbNo Then
Exit Sub
End If
datCurrentDate = DATE
datCurrentDate = Time()
strAddSQL = "INSERT INTO tblMunicipalityCode " & _
" (MunicipalityCodeDesc, AddDate, AddTime, AddUserID) " & _
" VALUES('" & strNewCode & "', #" & datCurrentDate & "#, #" & datCurrentTime & "#, " & intEmployeeID & ")"
' MsgBox strAddSQL
DoCmd.SetWarnings False
DoCmd.RunSQL (strAddSQL)
DoCmd.SetWarnings True
lbxAvailableCodes.Requery
End Sub
Do I have to include this type of code for my Zip Code form?
The Zip table only has City, St, Zip fields, so I would think it can't be too difficult to figure this out.
If so, I think I can figure it out, but can someone tell me what the # means?