ms-access-2010

Syntax error in INSERT INTO statement for Access 2010

狂风中的少年 提交于 2020-01-26 10:54:26
问题 My INSERT statement apparently has a syntax error. Could someone please explain why that might be? Private Sub Register_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Register.Click Dim StudentNum As String Dim Password As String Dim FirstName As String Dim LastName As String Dim YrandSec As String StudentNum = Number.Text() Password = Pass.Text FirstName = First.Text LastName = Last.Text YrandSec = YrSec.Text() SQL = "INSERT INTO Accounts(StudNo,Password

Make fields visible in MS Access form as certain fields are completed

时光怂恿深爱的人放手 提交于 2020-01-25 08:08:21
问题 I am building a form In MS Access for users to input data but there are too many possible fields. Most of the time only about half the fields will be used. I thus would like to have certain fields appear only depending on what the user inputted on a prior given field. Ex: user enters project number, title, then he checks a "yes/no" engineering. since he checked it this means engineering is impacted so a dozen fields that the user will have to fill out appear. Is this possible: 1)without VBA 2

Combine multiple fields with condition

点点圈 提交于 2020-01-25 05:35:26
问题 I have multiple MS Access fields and I need to combine most of them with a condition. I'm still a beginner with complicated SQL queries thus the limitation to translate the following pseudocode into reality: SELECT field_1, field_2, field_3 CREATE new_field // these would be WHERE-queries if field_1 & field_2 are "missing", "unknown" or empty then new_field = field_3 else if field_2 & field_3 are "missing", "unknown" or empty then new_field = field_1 else if field_1 & field_3 are "missing",

Calling a UDF (Sql server) from VB Access “Undefined function <function name> in expression”

隐身守侯 提交于 2020-01-24 19:12:05
问题 I am trying to call a udf (SQL server) from Vb code in access. Connection to DB was successful and I am able to run queries on SQL server tables. However, when I try to call the UDF, it throws me an error saying undefined function . Please see the code below: Private Sub cmd_Login_Click() ' some code here Set db = CurrentDb() sSQL = "SELECT UserID FROM TBL_User_Login WHERE UserName = '" & cbo_User & "' AND Status = 0" Set recset = db.OpenRecordset(sSQL) recset.Close Set rectset = Nothing sSQL

Calling a UDF (Sql server) from VB Access “Undefined function <function name> in expression”

南笙酒味 提交于 2020-01-24 19:11:23
问题 I am trying to call a udf (SQL server) from Vb code in access. Connection to DB was successful and I am able to run queries on SQL server tables. However, when I try to call the UDF, it throws me an error saying undefined function . Please see the code below: Private Sub cmd_Login_Click() ' some code here Set db = CurrentDb() sSQL = "SELECT UserID FROM TBL_User_Login WHERE UserName = '" & cbo_User & "' AND Status = 0" Set recset = db.OpenRecordset(sSQL) recset.Close Set rectset = Nothing sSQL

Rounding dates to the day in an SQL query

给你一囗甜甜゛ 提交于 2020-01-24 18:24:23
问题 I am stuck with something. I am trying to take a long column of dates of which are formated to show also hours and minutes and run a Group query to paste values at the date level without acknowledging the differences in hours and minutes.. Unfortunately I have no clue how to start. The code i put together so far which returns each grouped date with the hour and minutes is as follows: st_sql = "INSERT INTO [tblSearchEngine03] ([Date])" & _ "SELECT [tblSearchEngine02].[Date]" & _ "FROM

How can I sort the columns in a crosstab query, when the column data is dynamic?

你说的曾经没有我的故事 提交于 2020-01-22 14:39:52
问题 I've been doing a bit of research on this topic and I can't seem either find a workable solution, or one that is explained well enough for me to implement. If you've ever created a crosstab query in Access, you are aware that by default Access sorts your columns in alphabetic order. You can change this order by going to the Properties dialog and entering the Column Headings in the order that you prefer. This is a real pain but, as one answerer mentioned on another site, "It's only a pain once

How can I sort the columns in a crosstab query, when the column data is dynamic?

为君一笑 提交于 2020-01-22 14:38:10
问题 I've been doing a bit of research on this topic and I can't seem either find a workable solution, or one that is explained well enough for me to implement. If you've ever created a crosstab query in Access, you are aware that by default Access sorts your columns in alphabetic order. You can change this order by going to the Properties dialog and entering the Column Headings in the order that you prefer. This is a real pain but, as one answerer mentioned on another site, "It's only a pain once

MS Access VBA trapping SQL Server Connection Error

☆樱花仙子☆ 提交于 2020-01-22 03:38:06
问题 I'm Having problems getting Access (2010) VBA to trap errors for connections to a SQL Server (2008) for linking tables. I'm getting an error and popup windows, presumably from the ODBC Driver? I want to suppress these and handle the error myself. I know about the DAO.errors and ADO.errors collections but these don't help if I can't get the error to call my error handler! The code below will give the error (unless you happen to have a table called myTable in a database called myDatabase on a

Data type mismatch in criteria expression. MS Access VB

夙愿已清 提交于 2020-01-22 03:14:47
问题 ' OK button Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim con As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\Users\Jill\Desktop\saddbase\Sadsystem\Sadsystem\bin\Debug\tenant.mdb") Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM info WHERE TN_ID = '" & UsernameTextBox.Text & "' AND Password = '" & PasswordTextBox.Text & "' ", con) con.Open() Dim sdr As OleDbDataReader = cmd.ExecuteReader() ' If the