K
Karen Hagerman
Why doesn't this work?
1.
Dim intTopOne As Integer
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rst As ADODB.Recordset
Dim strSQL As String
Set cnn = CurrentProject.Connection
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cnn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT TOP 1 tblRent.RentID FROM tblRent"
intTopOne = cmd.Execute
or this
2.
Setting the control source for a text box to a query with the above SQL statement
There must be a way to set a variable to the result of a SQL statement but I'm just stymied.
Karen
1.
Dim intTopOne As Integer
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rst As ADODB.Recordset
Dim strSQL As String
Set cnn = CurrentProject.Connection
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cnn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT TOP 1 tblRent.RentID FROM tblRent"
intTopOne = cmd.Execute
or this
2.
Setting the control source for a text box to a query with the above SQL statement
There must be a way to set a variable to the result of a SQL statement but I'm just stymied.
Karen