Join 136,574 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,884 people online right now. Registration is fast and FREE... Join Now!
hi, i try to make the database to be updated with .addnew,.update function in the array below. but there was an error.as the below coding, i haven't make any changes to makesure the database be updated as the new data entered.help me. . for information. this is about interconnected within two forms, that is main form, and addnew projects form(child form).
as the coding below, i havent add database code since it needs to be an array. any inquiries, do let me know, easy for me to make it more clear. tq so much
'this is a part of the main form to display the projects
vb
Public Sub Display_The_Projects() Dim intCounter As Integer Dim intCounter_2 As Integer Dim intCounter_Outside As Integer Dim Date_In As Date Static blnNot_First_Time As Boolean 'blnNot_First_Time = False ' Initial Array Assignments
If blnNot_First_Time = False Then datTo_Do.Recordset.MoveFirst
intCounter = 1 intCounter_2 = datTo_Do.Recordset!Tab_Number Do Until datTo_Do.Recordset.EOF If intCounter_2 <> datTo_Do.Recordset!Tab_Number Then intCounter = 1 intCounter_2 = datTo_Do.Recordset!Tab_Number End If gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 1) = datTo_Do.Recordset!comment If datTo_Do.Recordset!Code = "A" Then gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = "Active" ElseIf datTo_Do.Recordset!Code = "R" Then gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = "Reactive" End If gdtmTo_Do_Dates(datTo_Do.Recordset!Tab_Number + 1, intCounter, 1) = datTo_Do.Recordset!Date_Entered gdtmTo_Do_Dates(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = datTo_Do.Recordset!Date_Due intCounter = intCounter + 1 datTo_Do.Recordset.MoveNext blnNot_First_Time = True Loop End If
Date_In = #9/23/1999# For intCounter_Outside = 1 To 6 picTo_Do(intCounter_Outside).Cls ' Clear the picture box For intCounter = 1 To 12 ' Set the color and print the project If gstrTo_Do_Array(intCounter_Outside, intCounter, 1) > "" Then If gdtmTo_Do_Dates(intCounter_Outside, intCounter, 2) < Date_In Then picTo_Do(intCounter_Outside).ForeColor = vbRed ElseIf gstrTo_Do_Array(intCounter_Outside, intCounter, 2) = "Active" Then picTo_Do(intCounter_Outside).ForeColor = vbBlack Else picTo_Do(intCounter_Outside).ForeColor = vbMagenta End If
' Position the cursor then Print the project
picTo_Do(intCounter_Outside).CurrentX = 50 picTo_Do(intCounter_Outside).CurrentY = (intCounter - 1) * 300 + 40 picTo_Do(intCounter_Outside).Print gstrTo_Do_Array(intCounter_Outside, intCounter, 1) End If Next intCounter Next intCounter_Outside End Sub
'this the the addnew project form
vb
Private Sub cmdCancel_button_Click() Unload frmAdd_To_Do End Sub
Private Sub cmdOk_Button_Click() Dim intCounter As Integer Dim intPriority As Integer
' Determine the Priority
For intCounter = 1 To 5 If optTo_Do_Priorities(intCounter).Value = True Then intPriority = intCounter End If Next intCounter
' Find the first empty spot in the array
intCounter = 1 Do While gstrTo_Do_Array(intPriority, intCounter, 1) <> "" And intCounter < 12 intCounter = intCounter + 1 Loop
'for info, i need to make my database updated using .addnew, .update in those below array 'since that, i havent add any database code
hi, i try to make the database to be updated with .addnew,.update function in the array below. but there was an error.as the below coding, i haven't make any changes to makesure the database be updated as the new data entered.help me. . for information. this is about interconnected within two forms, that is main form, and addnew projects form(child form).
as the coding below, i havent add database code since it needs to be an array. any inquiries, do let me know, easy for me to make it more clear. tq so much
CODE
'this is a part of the main form to display the projects
Public Sub Display_The_Projects() Dim intCounter As Integer Dim intCounter_2 As Integer Dim intCounter_Outside As Integer Dim Date_In As Date Static blnNot_First_Time As Boolean 'blnNot_First_Time = False ' Initial Array Assignments
If blnNot_First_Time = False Then datTo_Do.Recordset.MoveFirst
intCounter = 1 intCounter_2 = datTo_Do.Recordset!Tab_Number Do Until datTo_Do.Recordset.EOF If intCounter_2 <> datTo_Do.Recordset!Tab_Number Then intCounter = 1 intCounter_2 = datTo_Do.Recordset!Tab_Number End If gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 1) = datTo_Do.Recordset!comment If datTo_Do.Recordset!Code = "A" Then gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = "Active" ElseIf datTo_Do.Recordset!Code = "R" Then gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = "Reactive" End If gdtmTo_Do_Dates(datTo_Do.Recordset!Tab_Number + 1, intCounter, 1) = datTo_Do.Recordset!Date_Entered gdtmTo_Do_Dates(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = datTo_Do.Recordset!Date_Due intCounter = intCounter + 1 datTo_Do.Recordset.MoveNext blnNot_First_Time = True Loop End If
Date_In = #9/23/1999# For intCounter_Outside = 1 To 6 picTo_Do(intCounter_Outside).Cls ' Clear the picture box For intCounter = 1 To 12 ' Set the color and print the project If gstrTo_Do_Array(intCounter_Outside, intCounter, 1) > "" Then If gdtmTo_Do_Dates(intCounter_Outside, intCounter, 2) < Date_In Then picTo_Do(intCounter_Outside).ForeColor = vbRed ElseIf gstrTo_Do_Array(intCounter_Outside, intCounter, 2) = "Active" Then picTo_Do(intCounter_Outside).ForeColor = vbBlack Else picTo_Do(intCounter_Outside).ForeColor = vbMagenta End If
' Position the cursor then Print the project
picTo_Do(intCounter_Outside).CurrentX = 50 picTo_Do(intCounter_Outside).CurrentY = (intCounter - 1) * 300 + 40 picTo_Do(intCounter_Outside).Print gstrTo_Do_Array(intCounter_Outside, intCounter, 1) End If Next intCounter Next intCounter_Outside End Sub
'this the the addnew project form
Private Sub cmdCancel_button_Click() Unload frmAdd_To_Do End Sub
Private Sub cmdOk_Button_Click() Dim intCounter As Integer Dim intPriority As Integer
' Determine the Priority
For intCounter = 1 To 5 If optTo_Do_Priorities(intCounter).Value = True Then intPriority = intCounter End If Next intCounter
' Find the first empty spot in the array
intCounter = 1 Do While gstrTo_Do_Array(intPriority, intCounter, 1) <> "" And intCounter < 12 intCounter = intCounter + 1 Loop
'for info, i need to make my database updated using .addnew, .update in those below array 'since that, i havent add any database code