D
Doug Maki
I am currently looking into splitting our database. We
supply this database to various Ambulance services
including our own. We wrote it here because most of our
rural departments cannot afford to purchase computerized
report/billing system. However we have 2 versions one is
Office where all the billing and statistical reports are
done and the other is a field version. Has only what is
necessary to complete an ambulance report. The reports
are transfered by code from the data entry version into
the Office versions but I get run time error 3251.
Operation is not supported for this type of object. Here
is the code and I put a * next to where the debugger
stopped. This code has worked fine until I split the
databases. What do I need to change to make it work now
that they are split.
Private Sub cmdTransfer_Click()
Dim frndb As Database, db As Database
Dim rec As Recordset, rst As Recordset
Dim vardrive As String
Dim suma As Integer, sumb As Integer
MsgBox "Select appropriate program to get patient
data from."
Me.dlgCommon.ShowOpen
vardrive = Me.dlgCommon.filename
Set db = CurrentDb()
Set frndb = OpenDatabase(vardrive,
dbDriverPrompt, False, ";UserID=Transfer;PWD=549")
Set rec = frndb.OpenRecordset("tblPatients")
Set rst = db.OpenRecordset("tblPatients")
If rec.BOF = True Then
MsgBox "No Records To Transfer"
Exit Sub
Else
End If
suma = rst.RecordCount
rec.MoveFirst
MsgBox "Checking and Transferring new Patient
Data!"
Do Until rec.EOF
* rst.Index = "PrimaryKey"
rst.Seek "=", rec![SSN]
If rst.NoMatch Then
With rst
.AddNew
![SSN] = rec![SSN]
!LastName = rec!LastName
!FirstName = rec!FirstName
!MidInit = rec![MidInit]
![StreetAddress] = rec![StreetAddress]
!City = rec!City
!CityCode = rec!CityCode
!County = rec!County
!CountyCode = rec!CountyCode
!State = rec!State
!Zip = rec![Zip]
![AreaCode] = rec![AreaCode]
!Phone = rec!Phone
![BirthDate] = rec![BirthDate]
!Age = rec!Age
!NationalOrigin = rec!NationalOrigin
!Sex = rec!Sex
![MaritalStatus] = rec![MaritalStatus]
![EmploymentStatus] = rec![EmploymentStatus]
!Weight = rec!Weight
!Resident = rec!Resident
![GuarantorSSN] = rec![GuarantorSSN]
![LnameGuarantor] = rec![LnameGuarantor]
![FnameGuarantor] = rec![FnameGuarantor]
![MidInitGuarantor] = rec![MidInitGuarantor]
![AddressGuarantor] = rec![AddressGuarantor]
![CityGuarantor] = rec![CityGuarantor]
![StateGuarantor] = rec![StateGuarantor]
![ZipGuarantor] = rec![ZipGuarantor]
![ACGuarantor] = rec![ACGuarantor]
![PhoneGuarantor] = rec![PhoneGuarantor]
!Relationship = rec!Relationship
![GuarantorSex] = rec![GuarantorSex]
![InsuranceClass] = rec![InsuranceClass]
![InsuranceCompany] = rec![InsuranceCompany]
![GroupNumber] = rec![GroupNumber]
![PolicyNumber] = rec![PolicyNumber]
![MedicareNmbr] = rec![MedicareNmbr]
![MedicareState] = rec![MedicareState]
![MedicaidNmbr] = rec![MedicaidNmbr]
![MedicaidState] = rec![MedicaidState]
![PatientEmployer] = rec![PatientEmployer]
![GuarantorEmployer] = rec![GuarantorEmployer]
![InsuredIDNumber] = rec![InsuredIDNumber]
![PrimaryInsuranceCo] = rec!PrimaryInsuranceCo]
![PrimaryGroupNumber] = rec[PrimaryGroupNumber]
![SecondaryInsurance] = rec[SecondaryInsurance]
![SecondaryGroupNumber] = rec[SecondaryGroupNumber]
![OtherInsurance] = rec![OtherInsurance]
![OtherGroupNumber] = rec![OtherGroupNumber]
![GuarantorBirthDate] = rec![GuarantorBirthDate]
rst.Update
rec.MoveNext
'Once one set of records are transfered,
repeats until all are done. Unlike
'the transfer of the other records, there is
supposed to be duplicates so
'this procedure transfers all but the
duplicates.
End With
Else
rec.MoveNext
End If
Loop
sumb = rst.RecordCount
sumb = sumb - suma
MsgBox sumb & " New Patient Data Transfered!"
GoTo cmdUploadPtData_Click_Exit:
'Closes the connection to the other database and sets
the variable values to
' Nothing. The next step in the transfer is than
started.
cmdUploadPtData_Click_Exit:
rst.Close
rec.Close
frndb.Close
Set rst = Nothing
Set rec = Nothing
Set frndb = Nothing
Call MARFTransfer(vardrive)
End Sub
supply this database to various Ambulance services
including our own. We wrote it here because most of our
rural departments cannot afford to purchase computerized
report/billing system. However we have 2 versions one is
Office where all the billing and statistical reports are
done and the other is a field version. Has only what is
necessary to complete an ambulance report. The reports
are transfered by code from the data entry version into
the Office versions but I get run time error 3251.
Operation is not supported for this type of object. Here
is the code and I put a * next to where the debugger
stopped. This code has worked fine until I split the
databases. What do I need to change to make it work now
that they are split.
Private Sub cmdTransfer_Click()
Dim frndb As Database, db As Database
Dim rec As Recordset, rst As Recordset
Dim vardrive As String
Dim suma As Integer, sumb As Integer
MsgBox "Select appropriate program to get patient
data from."
Me.dlgCommon.ShowOpen
vardrive = Me.dlgCommon.filename
Set db = CurrentDb()
Set frndb = OpenDatabase(vardrive,
dbDriverPrompt, False, ";UserID=Transfer;PWD=549")
Set rec = frndb.OpenRecordset("tblPatients")
Set rst = db.OpenRecordset("tblPatients")
If rec.BOF = True Then
MsgBox "No Records To Transfer"
Exit Sub
Else
End If
suma = rst.RecordCount
rec.MoveFirst
MsgBox "Checking and Transferring new Patient
Data!"
Do Until rec.EOF
* rst.Index = "PrimaryKey"
rst.Seek "=", rec![SSN]
If rst.NoMatch Then
With rst
.AddNew
![SSN] = rec![SSN]
!LastName = rec!LastName
!FirstName = rec!FirstName
!MidInit = rec![MidInit]
![StreetAddress] = rec![StreetAddress]
!City = rec!City
!CityCode = rec!CityCode
!County = rec!County
!CountyCode = rec!CountyCode
!State = rec!State
!Zip = rec![Zip]
![AreaCode] = rec![AreaCode]
!Phone = rec!Phone
![BirthDate] = rec![BirthDate]
!Age = rec!Age
!NationalOrigin = rec!NationalOrigin
!Sex = rec!Sex
![MaritalStatus] = rec![MaritalStatus]
![EmploymentStatus] = rec![EmploymentStatus]
!Weight = rec!Weight
!Resident = rec!Resident
![GuarantorSSN] = rec![GuarantorSSN]
![LnameGuarantor] = rec![LnameGuarantor]
![FnameGuarantor] = rec![FnameGuarantor]
![MidInitGuarantor] = rec![MidInitGuarantor]
![AddressGuarantor] = rec![AddressGuarantor]
![CityGuarantor] = rec![CityGuarantor]
![StateGuarantor] = rec![StateGuarantor]
![ZipGuarantor] = rec![ZipGuarantor]
![ACGuarantor] = rec![ACGuarantor]
![PhoneGuarantor] = rec![PhoneGuarantor]
!Relationship = rec!Relationship
![GuarantorSex] = rec![GuarantorSex]
![InsuranceClass] = rec![InsuranceClass]
![InsuranceCompany] = rec![InsuranceCompany]
![GroupNumber] = rec![GroupNumber]
![PolicyNumber] = rec![PolicyNumber]
![MedicareNmbr] = rec![MedicareNmbr]
![MedicareState] = rec![MedicareState]
![MedicaidNmbr] = rec![MedicaidNmbr]
![MedicaidState] = rec![MedicaidState]
![PatientEmployer] = rec![PatientEmployer]
![GuarantorEmployer] = rec![GuarantorEmployer]
![InsuredIDNumber] = rec![InsuredIDNumber]
![PrimaryInsuranceCo] = rec!PrimaryInsuranceCo]
![PrimaryGroupNumber] = rec[PrimaryGroupNumber]
![SecondaryInsurance] = rec[SecondaryInsurance]
![SecondaryGroupNumber] = rec[SecondaryGroupNumber]
![OtherInsurance] = rec![OtherInsurance]
![OtherGroupNumber] = rec![OtherGroupNumber]
![GuarantorBirthDate] = rec![GuarantorBirthDate]
rst.Update
rec.MoveNext
'Once one set of records are transfered,
repeats until all are done. Unlike
'the transfer of the other records, there is
supposed to be duplicates so
'this procedure transfers all but the
duplicates.
End With
Else
rec.MoveNext
End If
Loop
sumb = rst.RecordCount
sumb = sumb - suma
MsgBox sumb & " New Patient Data Transfered!"
GoTo cmdUploadPtData_Click_Exit:
'Closes the connection to the other database and sets
the variable values to
' Nothing. The next step in the transfer is than
started.
cmdUploadPtData_Click_Exit:
rst.Close
rec.Close
frndb.Close
Set rst = Nothing
Set rec = Nothing
Set frndb = Nothing
Call MARFTransfer(vardrive)
End Sub