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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in running application in window 98/2000

Status
Not open for further replies.

kyon

Programmer
Jul 3, 2003
9
HK
Hi,
I created an application using MS Visual Basic Programming Language and MS Access Database. There have many Insert, update and delete statement in the application.
I found that after I packing the application, I install it to my PC (used to develope the application). The insert update and delete statement in the application was function normally. However, when I install the application to others PC (include windows 98 and 2000). I found the update and delete in the application will not take effect to the Access Database. Some source code is as follow:

Dim dbProvider As String = "Microsoft.Jet.OLEDB.4.0"
Dim dbCnn As String = "\\Adserver\apps\Project2003
\Uniform\Data\UniformTest.mdb"
dim sql as string
dim cnnForm As adodb.Connection

Set cnnForm = Nothing
Set cnnForm = New adodb.Connection

cnnForm.Provider = dbProvider
cnnForm.CursorLocation = adUseClient

cnnForm.Open dbCnn, "", ""

sql = "update MeasureSch" & _
" set Measurement = '" & action & "'" & _
", Modify_User = '" & modVariable.user & "'" & _
", Modify_Date = #" & Format(Date, "yyyy/mm/dd") & "#" & _
" where Cust_Code = '" & modVariable.custCode & "'" & _
" and Branch_Code = '" & cboBranchCode.Text & "'" & _
" and Staff_Code = '" & cboStaffCode.Text & "'" & _
" and Measure_Date = #" & cboMeasureDate.Text & "#" & _
" and Measure_Time = '" & cboMeasureTime.Text & "'"

cnnForm.Execute sql

Does anyone have encounter such problem? How do you solve the problem? Does anything I have to check?

Any suggestion is welcome!

Thank you thank you very much!!!

kyon


 
This may be the cause of your problem ......maybe not.

One thing I always find a problem is the use of dates in SQL queries.
It might me that the other machine's regional settings have different date formats that your own machine and when the query is concatenated by your app, a different date presentation is used (and perhaps not found) in your database.

I always use the format(datefield, "dd Mmm yyyy") function to make sure I convert the dates to a standard date. (or the format of the field in the table)

Graham
 
1. Add:

Dim lRecordsAffected As Long
cnnForm.Execute sql, lRecordsAffected
MsgBox lRecordsAffected

Is lRecordsAffected > 0?

2. If lRecordsAffected is greater than zero, maybe you just are not seeing the additions right away because of a delayed write?
If so, close the application, wait a minute, and then open the mdb through ACCESS and see if the changes are there.
If they are there, just delayed, then use the same connection object to read the data that was used to write the data.

3. If lRecordsAffected = zero, then check your UPDATE statement.


 
Thanks Graham and CCLINT

Your suggestions are very useful. My problem is the same as Graham mention and the problem have solved. Thank you!

kyon

 
Ah, yes. I didn't read close enough to see the date format.

You will still have problems though, unless the program is used strictly on machines with the dates set in English.

All non-English locals, you will need to format the date differently, and using "dd Mmm yyyy" or "mm/dd/yyyy" in the Format function will usually not work.

We've covered this plenty of times in this forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top