I have a VB6 form into which users enter data which is saved to an Access 2002 db. At a later time it will need to be edited since there are several date fields that will need to be updated. I don't understand what the syntax would be to identify which component is updated, or do I simply call...
Thanks for the responses. "GM" I don't mind the philosophy. I am a professional philosopher doing social service work. This program tracks dozens of contracts for the agency for which I work. By and large a single user will be doing the initial entry and editing. "Chip" it happens with...
I have a VB6 program w/ several forms, one of which is the main input form for data which is then stored in an Access 2002 db. The other forms display the stored data depending on which fields the user uses to search by. Several of the fields on the input form will be left blank when used. As...
Thanks to all who helped. W/ Roy-Vidar's basic schema and ArteChoke's Len comments by removing the first half of the test and only using the Len component, it now builds a sql string w/ only the non-blank fields. Unfortunately because I have default text in some of the fields, if the user hits...
You are correct. I did try
if not isnull(txtFirstDate.text) then
I tried your suggestion--had to add an extra set of () before Len and after 0--got exactly the same response. It lists all the fields and all the values showing the blank dates as '##'. Any idea why it is not omitting the...
Thanks New Guy. I'm happy to say I figured that out :) which feels so good. Any idea why I'm getting the date error message. This whole thread and 3-week frustration is about trying to save a partial form to an access db when there are empty date fields on the form. Whew. It is a killing...
Printed to the Immediate window and discovered that the strSql statement contained an extra comma because you removed one character but had added a space after the comma. Changed it to -2 and it looks fine and removed that error message. Now the error message is my old favorite: Syntax error...
OK, I've rewritten my "save" code and while I don't see errors in the Debug Locals window, I do keep getting a runtime error message : Syntax error in INSERT INTO statement. Locals shows me that all the db fields are part of the strsql stmt even when the strval stmt includes nulls. Null dates...
Roy-Vidar, you're a smart dude. Where do you teach? Can you tell me the purpose of this part of your code?
strsql=mid$(strsql,1, len(strsql)-1) & ")"
strval=mid$(strval,1, len(strval)-1) & ")"
Con.Execute strsql & strval
Thanks.--Ed
WindDrinker--I like your solution, but I am unsure what to do with the fact that 10 of the other 17 fields on the form are date fields that might be blank. Is there some efficient way to write this (like maybe a complex conditional of some sort) that would make it practical to use this method...
Dim rs As ADODB.Recordset
Dim Con As ADODB.Connection
Dim ssql As String
Const strCon = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\EdM.SALVARMY\My Documents\Test.mdb"
Private Sub CmdSave_Click()
BiggerBrother--I just cannot figure...
I tried your suggestion and still get an error message about syntax in the INTO statement. I'll try to play around w/ the syntax. It looks right to me, but the only think I changed is the code you suggested. I tried filling in the other 17 fields and just leaving the Date-Filed empty. Still...
I have several text boxes in a VB6 entry form that take short dates and save them to an Access 2002 db. If I fill them all it works fine. If I leave any one of them empty I get the following error message: Syntax error in date in query expression '##'.
The code used to Enter and Save them...
Figured it out. The correct sql is:
"SELECT * FROM Contract " _
& "WHERE year(Start_Date) = " & Form3.TxtCtrtYear.Text & ""
Part of the issue was my failure to reselect the ADO DC on the form after I had copied the main form fields from an earlier form. Doh! Thanks to all who responded. --Ed
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.