Data Disappears

sirmilt

Member
Joined
Dec 14, 2006
Messages
17
Programming Experience
1-3
Hi

I'm working on an application with a lot of In and Out times. The application was originally written in VB 6 and converted to VB 2005 Express. There are a number of Control Arrays in the program,

I save the input form into 3 separate Access 2000 tables.

If I go back into a form that was previously started using the following code:
VB.NET:
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] LoadW1PriorTimes()[/SIZE]
[SIZE=2][COLOR=#008000]'This procedure loads the recorded in and out times for the selected timesheet...[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'Open database and table tPPDetail to prior hours w1...[/COLOR][/SIZE]
[SIZE=2]db = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ADODB.Connection[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] rsW1 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] ADODB.Recordset[/SIZE]
[SIZE=2]rsW1 = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ADODB.Recordset[/SIZE]
[SIZE=2]db.CursorLocation = ADODB.CursorLocationEnum.adUseClient[/SIZE]
[SIZE=2]db.Open(StrConnection)[/SIZE]
[SIZE=2]strSQL = [/SIZE][SIZE=2][COLOR=#800000]"SELECT * FROM tW1PPDetail WHERE EmployeeID = '"[/COLOR][/SIZE][SIZE=2] & frmLogIn.txtEmployeeID.Text & [/SIZE][SIZE=2][COLOR=#800000]"' AND PPStart = #"[/COLOR][/SIZE][SIZE=2] _[/SIZE]
[SIZE=2]& dtPPStart & [/SIZE][SIZE=2][COLOR=#800000]"#;"[/COLOR][/SIZE]
[SIZE=2]rsW1.Open(strSQL, db, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)[/SIZE]
[SIZE=2][COLOR=#008000]'Fill the Week 1 AM in and out times...[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] rsW1.RecordCount > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'Monday...[/COLOR][/SIZE]
[SIZE=2]txtAMIn(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1MonAMIn"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"H:MM AM/PM"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]txtAMOut(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1Monamout"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"H:MM AM/PM"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]txtPMIn(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1MonPMIn"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"H:MM AM/PM"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]txtPMOut(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1MonPMOut"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"H:MM AM/PM"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]txtOTIn(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1MonotIn"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"H:MM AM/PM"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]txtOTOut(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1Monotout"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"H:MM AM/PM"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]txtPBTUsed(0).Text = VB6.Format(rsW1.Fields([/SIZE][SIZE=2][COLOR=#800000]"W1MonPBTUsed"[/COLOR][/SIZE][SIZE=2]).Value, [/SIZE][SIZE=2][COLOR=#800000]"0.00"[/COLOR][/SIZE][SIZE=2])[/SIZE]
NOTE: The above code is only the first day of 14 that are included.

The text does not get filled in to the text boxes on the form. I tested every step and the values are correct. I even showed a message box at the very end of the code as follows:

VB.NET:
[/SIZE]
[SIZE=2]messageBox.Show(txtAMIn(0).Text)[/SIZE]
[SIZE=2]

the value was correct but the control txtAMIn(0).Text was empty.

I am lost as to where to go from here, except back to VB6. Any help that will point me at the solution would be great.
 
Last edited by a moderator:
The information very limited, and I hope my guess can give you some little help.

Please check that do you have any local variable that was declared and same with your control name.

Senario : Your GUI has a textbox called Textbox1 and you had declared another set of Textbox1 again in the method. As a result, whatever you put to the Textbox1 in the local, will disappear after you exit the method.
 
Back
Top