I am using the follow code to import data from a Word form into my MS Access 2010 DB:
Everything works great except for two fields:
![emsContacted] = doc.FormFields("emsContacted").Result
![emsTransported] = doc.FormFields("emsTransported").Result
On the Word Form, these two fields are drop-downs with three options: blank, No, and Yes. If the users leaves them blank, then Access ignores them--which is what I want. However, if the user says yes or no, Access puts a "-1" in the database. Both the Word form and Access field are text.
I can't figure this one out. I don't get any error messages. Were does the -1 come from? It is really causing problems.
Help. Thanks
Code:
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tmpSIRs", dbOpenDynaset)
With rst
.AddNew
'Incident Date/Time
![sirIncidentDate] = Format(doc.FormFields("sirIncidentDate").Result, "Medium Date")
![sirIncidentTime] = Format(doc.FormFields("sirIncidentTime").Result, "Short Time")
'Incident Location
![locRegion] = doc.FormFields("locRegion").Result
![locOffice] = doc.FormFields("locOffice").Result
'Submitter Information
![sirSubmitterEmail] = doc.FormFields("sirSubmitterEmail").Result
![sirSubmitterFirstNam] = doc.FormFields("sirSubmitterFirstNam").Result
![sirSubmitterLastName] = doc.FormFields("sirSubmitterLastName").Result
![sirSubmitterTelephon] = tSirSubmitterTelephone
'EMS Information
![emsContacted] = doc.FormFields("emsContacted").Result
![emsFormSubmited] = doc.FormFields("emsFormSubmited").Result
![emsLocation] = doc.FormFields("emsLocation").Result
![emsTransported] = doc.FormFields("emsTransported").Result
![emsType] = doc.FormFields("emsType").Result
'Property Information
![PropertyLocation] = doc.FormFields("PropertyLocation").Result
![PropertyQuantity] = doc.FormFields("PropertyQuantity").Result
![PropertyReportNumber] = doc.FormFields("PropertyReportNumber").Result
![PropertySN] = doc.FormFields("PropertySN").Result
![PropertyType] = doc.FormFields("PropertyType").Result
![Notification] = doc.FormFields("Notification").Result
![SirNumber] = doc.FormFields("SirNumber").Result
![ReportDate] = Format(doc.FormFields("ReportDate").Result, "Medium Date")
![ReportedBy] = UCase(doc.FormFields("ReportedBy").Result)
![ReportTime] = Format(doc.FormFields("ReportTime").Result, "Short Time")
.Update
Everything works great except for two fields:
![emsContacted] = doc.FormFields("emsContacted").Result
![emsTransported] = doc.FormFields("emsTransported").Result
On the Word Form, these two fields are drop-downs with three options: blank, No, and Yes. If the users leaves them blank, then Access ignores them--which is what I want. However, if the user says yes or no, Access puts a "-1" in the database. Both the Word form and Access field are text.
I can't figure this one out. I don't get any error messages. Were does the -1 come from? It is really causing problems.
Help. Thanks