Unless there is some specific reason you are using an ADO component I suggest the following that will do the same thing:
'Declaration
Private cn As ADODB.Connection
Private rs as ADODB.Recordset
Private strSQL as String
Private Const CONNECTION_STRING = _...
Currently as written, the procedures called by secondary form, can only be seen by the frmMain. To call these functions, you must first identify the form object and the VB Intellisense will show you these methods. The code should for the second form should like the following:
Sub cmdOK_Click()...
I don't know what your code looks like but here's an example of what you could do. The example below assigns the ListIndex property of the List control to the ListIndex property of the Combo box control in the OnClick event of the List control. To access the data I use the List property to...
Use the VB constant, vbTab, in order to include a tag in a concantenated string.
Example:
strData = 'The temperature is : " & vbTab & "65 degrees"
Create a function that gets the max value of the primary key using a SQL statement as follows:
Set rs = cn.Execute("SELECT MAX(pk_key) + 1 FROM TableName")
If Not rs.EOF Then
strPK_KEY = Right(CStr(Year(Date()),2) & "-001"
Else
strPK_KEY = rs(0)
End If
You need to exit the procedure, i.e., Exit Sub. If the procedure is a funtion, then Exit Function.
If Isnull(Me!DOB) Then
MsgBox "Date of Birth cannot be null. Please enter.", vbOKOnly
Me!DOB.SetFocus
Exit Sub
End If
Should be:
If strAnswer = vbYes Then GoTo Err_Denominator:
Not
If strAnswer = vbYes Then Err_Denominator:
Err_Demonitor is an error label not a subroutine.
CORRECT COPY:
The ComboBox control on the VB IDE Toolbar has an ItemData property which lets you associate a 32-bit integer value with each item loaded in the ComboBox control. You could store the Inventory ID here and reference it from the ItemData property as needed.
If Not rs.EOF
Do...
The ComboBox control on the VB IDE Toolbar has an ItemData property which lets you associate a 32-bit integer value with each item loaded in the ComboBox control. You could store the Inventory ID here and reference it from the ItemData property as needed.
If Not rs.EOF
Do While Not rs.EOF()...
Sorry, I may have confused you. You can pass through as many months as you want; it is depended upon your case statement.
The statement "The solution uses a CASE statement, that makes only a single pass through the table." was provided to let you know this the solution is much more...
Balves,
I am assuming that he wants to move ALL the data from an existing database to another existing database. Perhaps there is another way besides a cursor to move all the data. Of course if he is just moving a record then it would hold true that a cursor is not needed.
Gary
Use a cursor to accomplish this task. The values in the brackets are replaceable values as well as the variables.
Keywords are capitalize
CREATE PROCEDURE [sp_name] AS
'Declare variables
DECLARE @var1 char(1),
@var2 int
'Define the cursor
DECLARE [cursor_name] CURSOR FOR
SELECT var1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.