March 10, 2006 at 6:04 am
Hi
I'm tring to get the user to enter the correct information once they click on the cmdSave button.
The data in the field can be changed but must link to the table or query. I keep getting the msgbox even if the data exists.
Please HELP
Private Sub cmdSave_Click()
If Me.ClinicianID.Value <> "qryPatientCheck.ClinicianID" Then
MsgBox "Please Type in a valid ID as data will not be saved"
End If
End If
If Me.Dirty = True Then
If MsgBox("Do you want to save the changes made?", vbYesNo, "Save") = vbYes Then
DoCmd.RunCommand acCmdSaveRecord 'save option - if yes save else do nothing
End If
End If
end sub
March 10, 2006 at 6:58 am
assuming access97
dim rs as dao.recordset
dim sqlstring as string
sqlstring="SELECT clinicianid from qryPatientCheck where ClinicianID= " & Me.ClinicianID.Value
set rs=currentdb.openrecordset (sqlstring)
if rs.recordcount>0 then
'found
else 'not found
end if
rs.close
set rs=nothing
March 10, 2006 at 8:08 am
This does not work as there is no such thing as dao.recordset
March 10, 2006 at 8:41 am
If Forms![frmPatientCheck]![ClinicianID].Value <> Dlookup(FieldToReturn, TableName, Criteria) Then
msgbox "not correct"
end if
this does not work as well .HELP ME PLEASE
March 10, 2006 at 9:13 am
March 10, 2006 at 9:50 am
What technology you use to get your data ADO,DAO,.NET?
Is this in VB6,Access,.NET?
One of the 3 parameters of DLookup is probably the value you wish to look up.
*have a look at
http://www.mvps.org/access/general/gen0018.htm
If you are working in Access, we have a forum dedicated to Access here.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply