i am at my wits' end - i've tried DLookup, DLMax...etc...please help

simeon_rose

Registered User.
Local time
Today, 08:31
Joined
Nov 4, 2000
Messages
34
i have got a form based on one table, called tblcar, and in in is a field called Mini ID. I'll call this Mini ID2. It is a number. I have another table which is not bound to any form with another field called Mini ID which is an autonumber. i'll all this Mini ID1. what i need is a way of stating in my textbox which relates to Mini ID2 that this should be equal to the Mini ID1 with the highest value.
as you may have noticed, this forum is lttered with my questions...and still all i do is generate error after error, or in some cases, nothing at all. i've tried DMax and DLookup with all sorts of variations on the syntax but still it does not work.
can someone pleeeeeeeeeeease give me one final solution to my problem?

thank you,
simeon
 
I am still a bit confused as to exactly what you are trying to do but I'll give it another go.

Dim x As Integer
x = DMax("Mini ID1","OtherTableName")

Now the variable x will hold the largest number for Mini ID1 in the other table. You can now do what you want with this variable. You can set Mini ID2 to it or whatever.
 
Now I am confused. Looking at your previous posts, there appears to be some contradictions in what you want.

Do you want to type in a value in a textbox, which is then compared to a value in another unrelated table?

Do you want to type in a value in a textbox, which is then assigned as a value in another unrelated table?


Do you want to type in a value in a textbox, which is then compared to a value in another unrelated table, and returns values from that unrelated table to your current form?

How do you waant this activated? By clicking on the unbound text box, by shifting from the unbound textbox, or what?
 
i don't want to type in a value at all, i just want the text box to display the Mini ID with the highest value at all times which isn't 'activated', as such, but just is...
i realise my posts contradict themselves but this is only because i've got so desperate i've considered all options open to me (i think)...anyway, thanks...
 
Put an unbound text box on your form. Put this code in the Control Source event for that unbound text box: =DMax("[Mini ID]","OtherTableName")

This will "...display the Mini ID with the highest value" for the field Mini ID in your other table. Now I do not know what you mean by "...the highest value at all times which isn't 'activated', as such, but just is..."
 
THANK YOU...THANK YOU! it worked, at long last, it worked. there is still one problem however: why isn't the number generated in textbox added to the table that the form is linked together with the information from all the other textboxes?
 
It appears from your last responce you now want to store the Mini ID in the table with the rest of the data.

You could do this by setting a field in the table containing the rest of the data to a number or text field.

We will name this field x.

Create an unbound text box on your form, with properties set to visible = false.

introduce a on lost focus event or similar to mini Id or some other text file, and make x = mini ID
 
If you didn't post the same question under multiple topics and read the reply to you on the 22nd you would have found the answer sooner.
 

Users who are viewing this thread

Back
Top Bottom