Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting an old XP VB6 program to run on Windows 7 & Windows 10

BigTG

Programmer
Jul 3, 2023
4
GB
I posted a similar question a long time ago but never got round to resolving the issue. I tried the suggestions given but no luck. However I have had a chance to do further digging and have more information.

I have a very old VB6 program that I wrote, accessing an Access database, running on Windows XP. I am trying to convert it to run on Windows 7 & Windows 10 but both have the same issue.
The program prints labels. It has many functions including maintaining the database (add, delete, update and copy records), specifying search criteria and producing labels and addresses lists.
I have managed to get all the functionality working except one area in both Windows 7 & Windows 10.

The remaining problem is that the selected records are not being displayed in the text boxes on the form.

However, I know the database is being accessed correctly as the option to display the selected records on a form in a ListBox works fine. The SQL statement for the selection is generated correctly.
I can also print the sticky labels for the selection.

Also, on the form which displays the individual records, there is a Label which shows the count of the number of records selected. This is displayed correctly.
This is picked up from Adodc1.Recordset.RecordCount.

I have a Adodc object on the form to cycle round the records selected. This cycling works fine. However, the text fields which are linked to show the Access fields of each record as I cycle round are blank. That is, they are not being populated with the field values.

The main form uses an ADODC object, Adodc1, on the form to specify the database properties
CommandString: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Trevor\Labels\Label.mdb;Persist Security Info=False
RecordSource: SELECT * FROM address ORDER BY recno (the SELECT record can be further modified with WHERE selection criteria via options on the form).

(I have also tried using a converted .accdb access database with appropriate provider, i.e.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Trevor\Labels\Label.accdb;Persist Security Info=False
but same problem)

For the Windows 10 version I had to register 2 ocx files: mscomct2.ocx, msadodc.ocx. I downloaded them into c:\windows\SysWOW64.
These I downloaded from the internet for my Windows 10 (64-bit) machine.
(For the Windows 7 version I didn't have to download them as no error was given).

Thinking about it, should I I use these 2 ocx files from the XP system? I might try this.

I only have the VB6 development environment on the XP machine. So I have to change the program from there and copy the .exe file and database file over to the Windows 7 & Windows 10 machines.

Any help or suggestions would be appreciated.
 
VB6 runs very well on a Windows 7 or 10 machine. So you could install the VB environment on the newer Windows if you want.
I would suggest you do install it on your computer, be it a Windows 7 or 10, that doesn't matter.
Just make sure you have all components you need in the right spot.
I have the VB devellopment environment running on a Windows 11 24H2.
Back to your problem...
When using the ODBC drivers, you have to watch that they are the 32bit versions, since VB6 is 32 bit.
But since you're using the ADO, that should be ok.

If you want to keep working on the XP for devellopment you can't just use the debugger.
You could try some debugging with a set of messageboxes, since you don't have the environment on the Windows 7 or 10 machine.
Put a messagebox right after getting the record from the database to see what has been read.
If it happens in a loop, you might want to add a Cancel button to exit the loop when clicked. Otherwise you have a looooong time debugging.
If the data read are correct, you could try a doevents command right after the formfields are filled.
That might help VB to refresh the data on the form.
 
I posted a similar question a long time ago but never got round to resolving the issue. I tried the suggestions given but no luck. However I have had a chance to do further digging and have more information.

I have a very old VB6 program that I wrote, accessing an Access database, running on Windows XP. I am trying to convert it to run on Windows 7 & Windows 10 but both have the same issue.
The program prints labels. It has many functions including maintaining the database (add, delete, update and copy records), specifying search criteria and producing labels and addresses lists.
I have managed to get all the functionality working except one area in both Windows 7 & Windows 10.

The remaining problem is that the selected records are not being displayed in the text boxes on the form.

However, I know the database is being accessed correctly as the option to display the selected records on a form in a ListBox works fine. The SQL statement for the selection is generated correctly.
I can also print the sticky labels for the selection.

Also, on the form which displays the individual records, there is a Label which shows the count of the number of records selected. This is displayed correctly.
This is picked up from Adodc1.Recordset.RecordCount.

I have a Adodc object on the form to cycle round the records selected. This cycling works fine. However, the text fields which are linked to show the Access fields of each record as I cycle round are blank. That is, they are not being populated with the field values.

The main form uses an ADODC object, Adodc1, on the form to specify the database properties
CommandString: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Trevor\Labels\Label.mdb;Persist Security Info=False
RecordSource: SELECT * FROM address ORDER BY recno (the SELECT record can be further modified with WHERE selection criteria via options on the form).

(I have also tried using a converted .accdb access database with appropriate provider, i.e.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Trevor\Labels\Label.accdb;Persist Security Info=False
but same problem)

For the Windows 10 version I had to register 2 ocx files: mscomct2.ocx, msadodc.ocx. I downloaded them into c:\windows\SysWOW64.
These I downloaded from the internet for my Windows 10 (64-bit) machine.
(For the Windows 7 version I didn't have to download them as no error was given).

Thinking about it, should I I use these 2 ocx files from the XP system? I might try this.

I only have the VB6 development environment on the XP machine. So I have to change the program from there and copy the .exe file and database file over to the Windows 7 & Windows 10 machines.

Any help or suggestions would be appreciated.
Another option is to try importing everything into TwinBasic, and debug in that environment. I think 32-bit is the default compilation & is free, and 64-bit costs.

I don't know if it has support for those OCXs yet.
 
Your earlier post confirmed you still have the vb6 ide on an xp box. Have you tried packaging yopr app properly using the package and deployment tool, rather than simply copying over the exe and hoping?
 
I'd definitely try strongm's suggestion. It sounds like you don't have all the support files on the W7 or W10 machine. I've installed a VB6/Access97 programs on both W7 and W10 and they run fine. Whats amazing is they run even faster on W11 22H2 ARM as a VM under Parallels on a M4 MacBookl Pro. I wish I could get my VB6 IDE and Access97 running on the same machine but so far have had no luck. I should make a separate topic for that
 
1st off, try strongm's suggestion

else

I have forgotten a whole lot in the past decade or two no longer using vb but you might, depending upon the controls you used, because there is the standard textbox that came with vb and other textboxes that come with various things, like access. To make a long post shorter you might try .text = .value (or w/e it is called) inside a for each loop at the end of the navigation event/action and maybe throw in a doevents after the loop, or maybe put it in the change event of the textboxes? Man I can't really remember


Good Luck
 

Part and Inventory Search

Sponsor

Back
Top