2014-01-13 2 views
0

MSGBOX에 액세스 테이블에서 특정 ID를 얻을 수어떻게 특정 레코드의 ID를 얻으려면

이 내 코드입니다

If DLookup("Full_Name", "tbl_Personal_Information", "Full_Name = Forms!frm_New_Person!F_N") > 0 Then 
MSG = MsgBox("this person is existed and his id number is {" & [P_ID] & "} ", vbOKOnly + vbInformation + vbMsgBoxRtlReading, "client database") 
Else 
strsql101 = "insert into tbl_Personal_Information (Name_English, Father_English, Family_English, Mother_English, P_ID, NName, Father, Family, Mother, Birthdate, Nationality, Record_Number, Record_Place, Address, Mobile1, Mobile2, Phone1, Phone2, Ets_Name) Values ('" & Me.Name_English & "','" & Me.Father_English & "','" & Me.Family_English & "','" & Me.Mother_English & "','" & Me.PID & "','" & Me.NName & "','" & Me.Father & "','" & Me.Family & "','" & Me.Mother & "','" & Me.Birthdate & "','" & Me.Nationality & "','" & Me.Record_Number & "','" & Me.Record_Place & "','" & Me.Address & "','" & Me.Mobile_1 & "', '" & Me.Mobile_2 & "','" & Me.Phone_1 & "', '" & Me.Phone_2 & "','" & Me.Ets_Name & "')" 
DoCmd.SetWarnings False 
DoCmd.RunSQL strsql101 
MSG = MsgBox("information added", vbOKOnly + vbInformation + vbMsgBoxRtlReading, "client database") 

모든 확인하지만 MSGBOX의 ID 나에게주는 내 테이블의 마지막 ID

+0

안녕하세요. – BasILyoS

답변

1

당신이 원하는 레코드의 P_ID를 찾고있는 것처럼 보이지 않습니다.

이런 식으로해야할까요?

MSG = MsgBox("this person is existed and his id number is {" & DLookup("[P_ID]", "tbl_Personal_Information", "Full_Name = Forms!frm_New_Person!F_N") & "} ", vbOKOnly + vbInformation + vbMsgBoxRtlReading, "client database") 
관련 문제