IonicWind Software

IWBasic => Database => Topic started by: Brian on June 16, 2017, 03:28:34 AM

Title: Please help me!
Post by: Brian on June 16, 2017, 03:28:34 AM
Hi,

I have started a new program based on Paul Turley's addressbook code. I can enter a new record, but they just don't appear on screen. I haven't altered much of the code, and I'm sweating nails here trying to find out what's wrong

Please help!

Brian
Title: Re: Please help me!
Post by: Andy on June 16, 2017, 03:45:44 AM
Brian,

Don't you need to use GETSELECTED to get the selected entry and find the correcspoding DB entry which can then be placed into the fields?

I added two new entries in and they show up just fine - I think what you want to do is get the selected entry from the left hand side, and show the corresponding data for that entry in the db fields?


Title: Re: Please help me!
Post by: Brian on June 16, 2017, 04:00:10 AM
Andy,

The listbox on the side is just experimental code - it has nothing to do with the database at all
I can enter a new record, and then press Update, and nothing is added to the DB, just blank fields
You can look at the MDB "offline" with a viewer called MDBPlus. I've used it for ages, and is very handy. You will see there is nothing in the database - records, but no data
http://www.alexnolan.net/software/mdb_viewer_plus.htm

Brian
Title: Re: Please help me!
Post by: Andy on June 16, 2017, 04:25:15 AM
Brian,

I've changed it to a window.

I first clicked on New, added an entry in with aaaaaaa's, and the New again, this time used bbbbb's

exited, and ran it again, and it went straight to the first record - the aaaaa's

Attached is a quick window version.
Title: Re: Please help me!
Post by: Brian on June 16, 2017, 05:11:35 AM
Andy,

Thanks for that. Don't know why it should make such a difference. I've used Dialog windows before, and they have worked. Will look at your code now

Brian
Title: Re: Please help me!
Post by: Brian on June 16, 2017, 05:29:42 AM
Hello,

Well, I've just compiled the original addressbook.iwb from scratch, and that doesn't show any data as well, so it's not my code that's doing it

Will keep looking. If anyone could compile and try addressbook.iwb for me, that would be great to get a second opinion

Brian

PS: I'm thinking now it could be a Windows 10 issue. I found an old addressbook.exe with the corresponding addressbook.mdb and it ran fine. So I renamed the addressbook.mdb so that the program would create a fresh one, and it created the mdb, but wouldn't show any data when putting a new record in, ie, there is no data from the fields being stored
Title: Re: Please help me!
Post by: Andy on June 16, 2017, 06:23:43 AM
Brian,

The Addressbook example is also a dialog.

Don't use them myself, but I can tell you it works on my PC (Win 10 Pro 32 bit).

Title: Re: Please help me!
Post by: Brian on June 16, 2017, 06:38:32 AM
Andy,

Yep, I think that is the problem. I have Windows 10 64-bit, and there is a fair amount of correspondence on the internet about ODBC drivers and Win 10. It may be that the paths in the ODBC Data Sources are not set right. Still looking . . .

Although I think it is important that other folk look into this, as well, as it is going to affect everyone who uses 32-bit Ionic Wind software ODBC databases on their 64-bit Windows systems. I'm surprised that no one has noticed this problem yet

Brian
Title: Re: Please help me!
Post by: billhsln on June 16, 2017, 10:25:02 AM
The problem could be with permissions, these are responses to this problem from 3 different sources.  Hopefully the last will get you setup to allow permissions.

One of the issue with using the Access 2007 and later runtime is the new security mode. The Access runtime does not have the ability to set the trusted locations for the GUI. You have to do it some other way.

To use the Access 2007 or later runtime you have to create a trusted location for the database or set the macro security level to low by making a windows registry entry.

I have an article on the subject of trusted locations here: Trust Center in Access 2007 and 2010 Trusted Locations (Click link below) *** scroll down to the section: Setting the Trusted Locations when deploying the Access Runtime Version There you will also find a link to a free tool that will created the trusted location for you call addpath.

http://hitechcoach.com/index.php?option=com_content&view=article&id=51:trust-center-in-access-2007-and-2010&catid=61&Itemid=9


Hope this helps,
Bill
Title: Re: Please help me!
Post by: Brian on June 16, 2017, 11:17:56 AM
Thanks, Bill,

No idea what to do with those! I don't even have Access on my computer. I just rely on the ODBC drivers that are installed

There are definitely 32-bit drivers there. What's funny is that my code creates the MDB with no problems, but when adding a record the record is blank. Viewing the MDB shows that the records are created every time I select New record, but no data inside the record. Confused or what!

Brian
Title: Re: Please help me!
Post by: billhsln on June 16, 2017, 11:32:27 AM
Copied birchfield buddiesAndy.iwb, compiled and ran.  It created the MDB file and added 3 records with no problems.  I have Office 2007 installed on a Win 10 64bit machine.  I also have it defined to allow Access to run under the directories from IWB.

Bill
Title: Re: Please help me!
Post by: Brian on June 16, 2017, 11:48:01 AM
But Andy changed my code from Dialog to Window. The original addressbook code from Paul is a Dialog application, so there was no sense in changing it to a Window, as it already should run as a Dialog

If you haven't got Access installed on your PC, how on earth can you define something you haven't got, to run under the IWB directories? Sorry, still confused, and no further

Brian

Edit: I also ran Andy's code, and it did just the same as the Dialog code. It ran perfectly, but no data was inserted into a record
Title: Re: Please help me!
Post by: Brian on June 16, 2017, 12:41:25 PM
Bill,

Does this mean anything to you? I put in some error checking on doing an update, and this is what I got

Brian
Title: Re: Please help me!
Post by: billhsln on June 16, 2017, 12:46:15 PM
I loaded and tried your original and it worked fine.  I deleted the MDB file first before running.

The error sounds like you are storing text info in a numeric field or maybe the date field is in the wrong format.

Note: lines 78/79 need to be switched, but I still don't think the date is not in the correct format for Access:

   dbBindParameter(hStmt_update,10,date,40)
   date = DATE$()

Should be:

   date = DATE$()
   dbBindParameter(hStmt_update,10,date,40)

On the UPDATE, I would do dtadded = CURRENT DATE.  Then you won't need to worry about the date format.

Bill

Title: Re: Please help me!
Post by: Brian on June 16, 2017, 01:04:17 PM
Bill,

Fantastic! I modified the UPDATE line to "dtadded=DATE()" instead of dtadded=? and away we go. I also did the change to the BindParameter line that you suggested. CURRENT DATE threw an error, though, on the UPDATE line

Many thanks,

Brian
Title: Re: Please help me!
Post by: billhsln on June 16, 2017, 01:14:03 PM
I am surprised that on the UPDATE line dtadded=Current Date did not work.  That is standard SQL, I use it all the time.

I just switched lines 97/98 and it worked ok for me.  Seems it is ok with date = DATE$() format for dates.

Bill