Toukey-
Ok - I think the assignment of varx to string was the main culprit!
However I tried your code below and got the following:
Run-time error 2471:
The expression you entered as a query parameter produced this error: 'A022'
where A022 is actually the clientno
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
On Sep 7, 2014, at 4:28 PM, toukey1 <no_reply@yahoogroups.com> wrote:Thanks for your response John.
As you mentioned below, once I "dirty" the subform I can see that mawbno is in the tblentrylog. With regards to the primary key of tblentrylog, yes, it is an artificial AutoNumber.
The user wants when entering the data on the subform to be see if he has already entered info for a client. If the client already exists, he wants a message displayed to say so and show the hawbno (field from tblentrylog) so that he can reuse the hawbno. That's the reason I was thinking of using the dlookup. I tried using Me.Parent.mawbno but still getting the invalid use of null.
Toukey
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
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.mawbnoWhat 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, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL 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: Tony V Meece <mr_7ony@yahoo.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (16) |
Tidak ada komentar:
Posting Komentar