Toukey-
If you have the Link Master Fields / Link Child Fields of the subform control set properly, the value for mawbno should be there as soon as the user "dirties" the subform by selecting a value in the combo box. As long as the outer form isn't on a new record, you should also be able to get a value for mawbno by using:
Me.Parent.mawbno
What is the Primary Key of tblentrylog? If it is the combination of mawbno and clientno, then you don't need to perform a check at all. The unique index will ensure that a client gets entered only once for each value of mawbno. I would bet you have an artificial AutoNumber as the Pkey - this is just another example of why I don't like to use AutoNumber as an artificial Primary Key. The combo of mawbno and clientno will suffice.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Sep 7, 2014, at 6:08 AM, toukey1 <no_reply@yahoogroups.com> wrote:
Hi,
I have a main form (tblmanifest) and a sub-form (tblentrylog). After populating the main form which includes a field called mawbno I then go to the sub-form to enter the client via a combo box. After I enter the client I want to be able to check to see if I already entered data for that client and display a message that the client already exist. I was attempting to use the code below in the After Update property but getting "invalid use of null".
Dim varx As String
varx = DLookup("[clientno]", "tblentrylog", "[mawbno] = " & Me!mawbno)
Note that the mawbno is also saved in the tblentrylog.
Any assistance would be appreciated.
Thanks
Toukey
__._,_.___
Posted by: John Viescas <johnv@msn.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar