Hmm.. ohh. can do that? how? i dont know..
Hmm.. ohh. can do that? how? i dont know..
Observe the code below carefully. This will offer you a check protocol before your user enter data from the universal Form. The code is already embedded in the OnClick Event of Enter Data Button.
I have Included two more variables
Dim intCodeID
Dim strMsg
What I have done is a Simple DCount to Check if any Record with the value type is present. Rest of the code self explanatory. Remember you have to make adjustmen to all Cases of Select frmDataSource.
Dim strSQL As String
Dim strUpdateSQL As String
Dim intCodeID As Integer
Dim strMsg As String
If IsNull(Me.frmDataSource) Then
MsgBox "Please Select a datasource", vbInformation, "Select Data source"
ElseIf IsNull(Me.Text10) Then
MsgBox "Type Data in the Data Text Box"
Else
Select Case Me.frmDataSource
Case Is = 1
intCodeID = IIf(IsNull(DCount("[client_id]", "tblClient", "[client_name]=" & "'" & Me.Text10 & "'")), 0, DCount("[client_id]", "tblClient", "[client_name]=" & "'" & Me.Text10 & "'"))
If intCodeID >= 1 Then
strMsg = MsgBox("There Data might be present please check before insert. Click Yes to Continue and No to Abort", vbInformation + vbYesNo)
Select Case strMsg
Case vbYes
strUpdateSQL = "INSERT INTO tblClient(client_name) VALUES('"
strUpdateSQL = strUpdateSQL & Me.Text10 & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strUpdateSQL
DoCmd.SetWarnings True
strSQL = "SELECT * FROM tblClient"
Me.List0.RowSourceType = "Table/Query"
Me.List0.RowSource = strSQL
Case vbNo
MsgBox "Aborted"
End Select
Else
strUpdateSQL = "INSERT INTO tblClient(client_name) VALUES('"
strUpdateSQL = strUpdateSQL & Me.Text10 & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strUpdateSQL
DoCmd.SetWarnings True
strSQL = "SELECT * FROM tblClient"
Me.List0.RowSourceType = "Table/Query"
Me.List0.RowSource = strSQL
End If
Did you try out the check duplicate
i just read ur reply.. still check on it.. thank you so much,...
as u can see, i add another field in my project table. it is because the user want to type the id by themself. n also they want to let say key in the id in the maintainance form n all the details about the project will appear. can do that by access?
maximus, why the update form for all the record still does not appear with all the data. it still blank like the new form
ive checked the code. the acformedit and acformadd.
sometimes the data will all appear both in updating(all record) and updating (new record), but sometimes both will blank
I checked out the daatabase that I designed and if you still have it the Update Project all Record is working just Fine have you changed any thing. zip and send me your db let me see the problem.
nope. i didnt change anything. just ive add the main menu command button to the form. so then the user can back to main menu after fill up the form..
here is my db
then send me the mdb let me check.
already sent it
check it now
did you try it out
juz came back from my lunch hr. thanx maximus..