B
BEES via AccessMonster.com
Hi,
I really need help with this.
I have two Table PatientRecordTb and PTRTransTb.
PTRTransTb is unbound Both Table are same .
Up on Add Record Cmd which is placed on PatientTransFm, It does not
Process correctly, Up to update SQL statement it work great
Massage Box also appears but Yes and No response is not working in both
acmAddRecord ‘’ as well as Delete.
It will be great if Message Box conformed the Number of records added and
delete in their message box.
Here is the Code I am using
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
Dim pid As Long
Dim mySQLString As String
mySQLString = "INSERT INTO PatientRecordTb ( LastName, FirstName, MiddleName,
DOB, Address, City, ZipCode, Phone1, Phone2, Mobile, EntryDate, AgencyID,
StatusID, SubAgency, [Note], MdName, MdPhone, MdFax, MdAddress, NoVisit1,
Frequency1,TVisit1, NoVisit2, Frequency2,TVisit2, NoVisit3, Frequency3,
TVisit3,TotalNoOfVisitMade )"
mySQLString = mySQLString & " SELECT PTRTransTb.LastName, PTRTransTb.
FirstName, PTRTransTb.MiddleName, PTRTransTb.DOB, PTRTransTb.Address,
PTRTransTb.City, PTRTransTb.ZipCode, PTRTransTb.Phone1, PTRTransTb.Phone2,
PTRTransTb.Mobile, PTRTransTb.EntryDate, PTRTransTb.AgencyID, PTRTransTb.
StatusID, PTRTransTb.SubAgency, PTRTransTb.Note, PTRTransTb.MdName,
PTRTransTb.MdPhone, PTRTransTb.MdFax, PTRTransTb.MdAddress, PTRTransTb.
NoVisit1, PTRTransTb.Frequency1, PTRTransTb.TVisit1, PTRTransTb.NoVisit2,
PTRTransTb.Frequency2, PTRTransTb.TVisit2, PTRTransTb.NoVisit3, PTRTransTb.
Frequency3,PTRTransTb.TVisit3,PTRtransTb.TotalNoOfVisitMade"
mySQLString = mySQLString & " FROM PTRTransTb;"
DoCmd.RunSQL (mySQLString)
Up till here it is working good
If MsgBox( _
"Are you sure you want to Add these records?", _
vbYesNo, _
"Confirm acNewRec") _
= vbYes _
Then
DoCmd.SetWarnings False
DoCmd.GoToRecord , , acNewRec
End If
If MsgBox( _
"Are you sure you want to delete these records?", _
vbYesNo, _
"Confirm Deletion") _
= vbYes _
Then
DoCmd.SetWarnings False
DoCmd.RunSQL ("delete from PTRTransTb;")
Me.Requery
DoCmd.SetWarnings True
Exit_AddRecord_Click:
Exit Sub
Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click
End If
End Sub.
Up on delete Auto no should be Zero Table completely Empty .
I will be really appreciated If some one can help me whit this
I really need help with this.
I have two Table PatientRecordTb and PTRTransTb.
PTRTransTb is unbound Both Table are same .
Up on Add Record Cmd which is placed on PatientTransFm, It does not
Process correctly, Up to update SQL statement it work great
Massage Box also appears but Yes and No response is not working in both
acmAddRecord ‘’ as well as Delete.
It will be great if Message Box conformed the Number of records added and
delete in their message box.
Here is the Code I am using
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
Dim pid As Long
Dim mySQLString As String
mySQLString = "INSERT INTO PatientRecordTb ( LastName, FirstName, MiddleName,
DOB, Address, City, ZipCode, Phone1, Phone2, Mobile, EntryDate, AgencyID,
StatusID, SubAgency, [Note], MdName, MdPhone, MdFax, MdAddress, NoVisit1,
Frequency1,TVisit1, NoVisit2, Frequency2,TVisit2, NoVisit3, Frequency3,
TVisit3,TotalNoOfVisitMade )"
mySQLString = mySQLString & " SELECT PTRTransTb.LastName, PTRTransTb.
FirstName, PTRTransTb.MiddleName, PTRTransTb.DOB, PTRTransTb.Address,
PTRTransTb.City, PTRTransTb.ZipCode, PTRTransTb.Phone1, PTRTransTb.Phone2,
PTRTransTb.Mobile, PTRTransTb.EntryDate, PTRTransTb.AgencyID, PTRTransTb.
StatusID, PTRTransTb.SubAgency, PTRTransTb.Note, PTRTransTb.MdName,
PTRTransTb.MdPhone, PTRTransTb.MdFax, PTRTransTb.MdAddress, PTRTransTb.
NoVisit1, PTRTransTb.Frequency1, PTRTransTb.TVisit1, PTRTransTb.NoVisit2,
PTRTransTb.Frequency2, PTRTransTb.TVisit2, PTRTransTb.NoVisit3, PTRTransTb.
Frequency3,PTRTransTb.TVisit3,PTRtransTb.TotalNoOfVisitMade"
mySQLString = mySQLString & " FROM PTRTransTb;"
DoCmd.RunSQL (mySQLString)
Up till here it is working good
If MsgBox( _
"Are you sure you want to Add these records?", _
vbYesNo, _
"Confirm acNewRec") _
= vbYes _
Then
DoCmd.SetWarnings False
DoCmd.GoToRecord , , acNewRec
End If
If MsgBox( _
"Are you sure you want to delete these records?", _
vbYesNo, _
"Confirm Deletion") _
= vbYes _
Then
DoCmd.SetWarnings False
DoCmd.RunSQL ("delete from PTRTransTb;")
Me.Requery
DoCmd.SetWarnings True
Exit_AddRecord_Click:
Exit Sub
Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click
End If
End Sub.
Up on delete Auto no should be Zero Table completely Empty .
I will be really appreciated If some one can help me whit this