Using VB6 - I'm trying to update records - There is a data1 and MSFlexGrid on the Form.
When the form loads the code:
Private Sub Form_Load()
Dim D$, SQL$
D$ = "OUT"
SQL$ = "SELECT [Out].[Name], [Out].[Remarks] FROM Out WHERE ((([Out].[Remarks]) Is Not Null)) ORDER BY [Out].[Name];"
Data1.RecordSource = SQL$
Data1.Refresh
Text1.Text = SQL$
End Sub
Runs fine.
I added a command button for a user to press to update
the Remarks field in certain conditions:
The code on the command button is:
Private Sub Command1_Click()
Dim SQL2$, a1$, b1$
a1$ = "AM"
b1$ = "APPT/AM"
SQL2$ = "UPDATE OUT SET OUT.Remarks = b1$ WHERE ((([OUT].[Remarks])= a1$));"
Do Until Data1.Recordset.EOF
Data1.RecordSource = SQL2$
Data1.UpdateRecord
Data1.Recordset.MoveNext
Loop
text1.text = SQL2$
End Sub
The Text1 shows the SQL2 statement but the Remarks field
is not updated.
Am I missing something or do I need to add a statement
to the command button to get the Remarks field to update ?
Thanks
< I want to work in Theory - everything and everybody works in Theory !!>
When the form loads the code:
Private Sub Form_Load()
Dim D$, SQL$
D$ = "OUT"
SQL$ = "SELECT [Out].[Name], [Out].[Remarks] FROM Out WHERE ((([Out].[Remarks]) Is Not Null)) ORDER BY [Out].[Name];"
Data1.RecordSource = SQL$
Data1.Refresh
Text1.Text = SQL$
End Sub
Runs fine.
I added a command button for a user to press to update
the Remarks field in certain conditions:
The code on the command button is:
Private Sub Command1_Click()
Dim SQL2$, a1$, b1$
a1$ = "AM"
b1$ = "APPT/AM"
SQL2$ = "UPDATE OUT SET OUT.Remarks = b1$ WHERE ((([OUT].[Remarks])= a1$));"
Do Until Data1.Recordset.EOF
Data1.RecordSource = SQL2$
Data1.UpdateRecord
Data1.Recordset.MoveNext
Loop
text1.text = SQL2$
End Sub
The Text1 shows the SQL2 statement but the Remarks field
is not updated.
Am I missing something or do I need to add a statement
to the command button to get the Remarks field to update ?
Thanks
< I want to work in Theory - everything and everybody works in Theory !!>