[RESOLVED] It has been working fine for 3 months but ...
Hi,
I have been using this application for 3 months. It was working fine till yesterday. But now it is not working. Showing runtime error '13' when I am trying to save the data (and it highlights the code which is shown in bold in the following code).
The following is the code:
VB Code:
Private Sub cmdSave_Click()
If txtCustomerName.Text <> "" Then
With rs
.AddNew
.Fields("CustomerName").Value = txtCustomerName.Text
.Fields("SalesPerson").Value = txtSalesPerson.Text
.Fields("InvoiceNumber").Value = txtInvoiceNumber.Text
[B] .Fields("InvoiceDate").Value = CDate(txtInvoiceDate.Text)[/B]
.Fields("InvoiceAmount").Value = CCur(txtInvoiceAmount.Text)
.Fields("Description").Value = txtDescription.Text
.Fields("CreditPeriod").Value = CLng(txtCreditPeriod.Text)
.Fields("FileNumber").Value = txtFileNumber.Text
.Fields("City").Value = txtCity.Text
.Update
End With
Call Enable_FormControls
Call Save_UpdateControls
Call Instructions
cmdSave.Enabled = False
Else
Call Enable_FormControls
Call Save_UpdateControls
Call Instructions
cmdSave.Enabled = False
End If
End Sub
Thanks in advance.
Regards,
Seema_S
Re: It has been working fine for 3 months but ...
Has anyone changed the datatype of InvoiceDate field in the database? And have you checked what is there in txtInvoiceDate.Text?
Re: It has been working fine for 3 months but ...
Quote:
Originally Posted by Shuja Ali
Has anyone changed the datatype of InvoiceDate field in the database? And have you checked what is there in txtInvoiceDate.Text?
I am the one who is using this computer. I have not changed anything in this project. Just using to enter some data. What I have done is, installed some games on this computer, some of those causing error and not working. I have 4 tables in this database which has date fields in it. And all those causing the same error when saving the data.
Seema_S
Re: It has been working fine for 3 months but ...
Did you change your date formats recently? Debug through the code and try writing this in the Immediate window
VB Code:
?Cdate(txtInvoiceDate.Text)
And do the same with other date text fields also.
If you get an error then that means there is something wrong with the data that is present in the textbox.
Re: It has been working fine for 3 months but ...
Sounds like some regional settings got changed - have you looked at that?
Is your date/time appearing the same in the lower-right corner of the task bar when you hover over it?
1 Attachment(s)
Re: It has been working fine for 3 months but ...
Quote:
Originally Posted by szlamany
Sounds like some regional settings got changed - have you looked at that?
Is your date/time appearing the same in the lower-right corner of the task bar when you hover over it?
The following jpg file has some details. I have not changed any code recently.
Regards,
Seema_S
1 Attachment(s)
Re: It has been working fine for 3 months but ...
Quote:
Originally Posted by seema_s
The following jpg file has some details. I have not changed any code recently.
Regards,
Seema_S
I am getting the following error (jpg) frequently since yesterday when I am trying to play games. Is this the error causing the application getting that error?
Seema_S
Re: It has been working fine for 3 months but ...
I don't think this will be the reason why you are getting an error in your VB App.
Did you try what I suggested?
Re: It has been working fine for 3 months but ...
Quote:
Originally Posted by Shuja Ali
I don't think this will be the reason why you are getting an error in your VB App.
Did you try what I suggested?
Hi,
My all applications are having problem when trying to save them. Even some applications which doesn't have date value also saving fields as blank. I have re-installed the visual basic 6.0, but the problem is same.
Regards,
Seema_S
Re: It has been working fine for 3 months but ...
Well I am clueless as to what will cause this problem. Probably you installed something recently that screwed Windows. An Update or something similar to this.
Re: It has been working fine for 3 months but ...
Quote:
Originally Posted by Shuja Ali
Well I am clueless as to what will cause this problem. Probably you installed something recently that screwed Windows. An Update or something similar to this.
Hi,
Now it is working properly. The problem was with regional settings (date format). But still I don't know why those applicantion did not work which has only one txtbox (txtReminder) with string property.
Thanks.
Seema_S
Re: [RESOLVED] It has been working fine for 3 months but ...
dd/mm/yyyy is a date format that MS SQL does not like - was this ACCESS or MS SQL? I believe ACCESS also does not like that format.
CDate() follows regional settings - so you are at risk of problems with CDate().
I believe that the FORMAT() function can be told to force MM/DD/YYYY regardless of regional settings.
I was burned by regional settings in our high school attendance application when the spanish teacher selected commas as decimal points instead of periods...