Friday, August 29, 2008

Perceived Death of a Thumb Drive

I purchased a 4GB USB thumb drive two days ago. Working fine on both PCs (the corrupt one - see prior post and the backup).

Suddenly, neither computer can access it. Windows provides a drive letter, but when you try to open it, you get a "Insert disk into Drive E" message.

I formatted it in Computer Management--> Disk Management area, and voila! it works now.

I made the mistake of leaving it in the USB port while reformatting my C drive due to Windows installation. Perhaps the sequence through Windows (I wiped all partitions - perhaps the system saw this one) or the constant restarts. At any rate, at least it works now.

Disappearing Network Connections - XP Pro

I was working on my laptop and poof! all of my network adapters and network connections suddenly disappear. VPN adapter, USB to Ethernet adapter (docking station), NIC, Wi-fi, all Deterministic Network Enhancers, etc. Gone.

I do the classic warm and cold restart. No change.

I try to "create" a network connection. No option.

Follow Window's suggestion: uninstall driver, allow PnP to detect device, and reinstall. Can't uninstall drivers due to the system 'needing them to start up' (no they don't - a VPN software adapter to start? Never.)

I do a Windows XP repair installation. The only change is that I can now uninstall the driver, but the reinstall process proclaims a driver INF problem.

I download new drivers from Dell. Run through installation. "Problem installing new drivers." Right.

Search for this peculiar error on forums. Find that there is an MSDN article on the needed steps to have networking in XP. Go through various services (find that some are stopped), start them. No change. Article suggests to verify that "Simple TCP/IP Services" are installed in Windows Components. They are not. Try to install. Error.

I search the forums. Similar issue. Try sfc /scannow. Try an "Upgrade" Installation of XP. No change.

Alas, I had to reformat the entire drive. Per the forums, this is caused by a virus. Ironically, this disappearance of the connectivity occured while the AV was scanning.....

Forum posting here: http://forums.devshed.com/windows-help-34/network-card-won-t-install-due-to-internal-error-505183-2.html

Sunday, August 24, 2008

Issues with IsDBNull and MySQL Varchar Fields

This one is bizarre - I am not sure if the issue lies in with the .NET framework or MySQL.

Opening a DataReader on an Odbc connection type in VB.NET allows for the verification of null fields with the .IsDBNull function. However, in one instance, I was absolutely certain that a MySQL field was null (I had just created it), yet I kept getting a .NET error in the program when I tried to verify the null status. I checked and checked and tried many different things. I was using a VARCHAR(45) field and I noticed that most of the DB fields used were VARCHAR(250). Hence, I took a shot in the dark and changed the field to VARCHAR(250). The problems went away.

I still am not sure if this is a .NET or a MySQL error, but it was frustrating and bizarre to say the least.

Monday, August 18, 2008

Connecting to a SQL Database from Excel

First of all - WHY would anyone download data directly from a SQL database into an Excel spreadsheet on an automated basis? The simple fact that I am writing this indicates that someone needed it....but I think the idea is just silly.

1.: Create the necessary trigger (button) and double-click in design mode to start entering code.

2. Paste the following code into the beginning of the sub routine.
Dim dbs As Database
Dim rs As Recordset
Dim vtSql As String
Dim numberOfRows As Integer
ThisWorkbook.Activate

3. In my case, I read from the data in rows A12 through A30 and fed this into the SQL statement
''Open the database
For i = 12 To 30
'Get value from user
a = Me.Range("A" & i, "A" & i).Value
'If value is blank, skip processing
If a = "" Then GoTo 100
'All the fun database stuff
Set dbs = OpenDatabase("ENTER NAME OF OBDC DATA SOURCE NAME HERE", False, True, "ODBC;Regional=Yes")vtSql = "ENTER SQL STATEMENT HERE"
Set rs = dbs.OpenRecordset(vtSql)
'Drop data back onto the spreadsheet
Me.Range("B" & i).CopyFromRecordset rs
dbs.Close
Set dbs = Nothing
Set rs = Nothing
100
Next i

Wednesday, August 6, 2008

Relating VBA Function Output to Another Table in MS Access 2003

It is a functional limitation of MS Access. You cannot relate the output of a VBA function, displayed in a query, to data held in another table.

Hence, this presents a unique problem. In my case, I should just be using a SQL Server, but the project is going to be handed over to everyday users and the budget for it does not afford a customized front end.

I was trying to take a variety of dates held in field of records in Table 1, use a VBA function to round up the date to the 1st of the next month, and relate those dates to a date field in Table 2. Table 2 contained other data that I needed related to the transactions in Table 1.

Since I can't forge that relationship, I ended up having to make this MORE complex on a SIMPLER program to accomplish.

I developed a MS Excel spreadsheet, put in 30 years of dates (= A1+1 method), and then used an Excel function to round the dates up. I then imported this into MS Access as Table 3. The individual dates in Table 3 related to the dates in Table 1. The rounded up dates in Table 3 related to the 1st of the month only dates in Table 2.

There you have it - silly, but it works.

If you want a copy of the file, email me.

Saturday, August 2, 2008

How to Integrate SQL Database Content with Quickbooks

Published as an article on Google's knol service.


http://knol.google.com/k/garrett-fisher/how-to-integrate-sql-database-content/2y7bdb9ql4zr1/4#

Friday, August 1, 2008

How to Integrate Flying J Truck Stop Scanning with your System

I just wrote a Knol article on this subject. Try this link, if it does not work, paste the title of this blog posting into the search box at knol.google.com.

http://knol.google.com/k/garrett-fisher/how-to-integrate-flying-j-truck-stop/2y7bdb9ql4zr1/2#