Using 2000 can I do this without VB knowledge?

soojosie

Registered User.
Local time
Today, 13:27
Joined
Jun 3, 2003
Messages
17
:confused:I have created a small DB to keep track of meetings.
Main Form customer
Sub form meetings with customer
At the end of each meeting I make notes on the sub form and enter an agreed date for next meeting.
Q 1.
I would like the sub form to open at new record, or last record and with the agreed meeting date CARRIED OVER to the new record form. Have unsuccessfully tried (among many) DoCmd.GoToRecord , , acNewRec
Q 2
I love the idea of having a sub form, but am unsure when creating reports how to ask for information from “last record”.

thanks have spent hours looking thru messages and closest I found was Dmax but not sure how or where to find/use this.
 
Q 1 - There are a multitude of ways of doing this, you may want to start with an easy DLOOKUP and select the value from the prior record.
Q 2 - This depends on how you determine the last record. If you table has an autonumber field, you can select the MAX autonumber value within the subset of records for your main form (or what ever your criteria is for the current main record). As one way.
 
thanks FoFa - am a little further but bloodied

:eek:sorry I am very slow, I have been working with the DLookUp idea until my head has turned mushy - and I still can't get it.
I can get the last date in the table to be entered, but that only shows the same date on all subforms, whereas each subform is connected to a mainform.

This is my lastest attempt on Subform Load - all I get is a message saying I cancelled the previous operation, if I have I cant find how or where I did it

Me.Name of field I want populated = DLookUp("[fieldname of data from last record, this to be used in field I want ]", "table Name”, ”[ field I want populated]= Forms![mainform]![subform].Form![Name of field I want populated] ")

Have not used DLookUp before and this is what I've worked on with the help of MS Support, any ideas where I am going wrong, thanks, josie
 
all I get is a message saying I cancelled the previous operation, if I have I cant find how or where I did it
Josie,

If I may cut in here: It looks like you know what you're doing. Error messages should (sometimes) not be taken literally, as most of them are just trying to tell you that you are not operating the program the way it was "programmed", or instructed to operate. So, I wouldn't worry too much about that. But, on the technical note, I would say that in order to fix the issue at hand, a little more background and specific information on what exactly you want would be helpful.
This is my lastest attempt on Subform Load -

Me.Name of field I want populated = DLookUp("[fieldname of data from last record, this to be used in field I want ]", "table Name”, ”[ field I want populated]= Forms![mainform]![subform].Form![Name of field I want populated] ")
This code looks OK to me, but the problem might lie in the fact that you have put the syntax with the load event of the form. I think you mentioned that you are dealing with more than one subform, and you didn't go into detail about it, but that might also be a source of error here.

I can tell you one thing for sure though: The function that you provided should work just fine if you are loading (I think!) a separate subform, that is completely independent of the subform you are getting a value from. That sub too, has to only be nested inside the Main Form, as that is how your code is written. Another thing to know about DLookup is that, when you don't specify criteria (which you have, I know), the function will return a random value in the field you are querying.
 
Last edited:
Thanks ajetrupet

Situation is

Main Form = “frmCustomer” = tblCustomer
Subform = "subContact" = tblContact
Nested inside the Main Form “frmCustomer” is a subform "subContact"

I create a new record in "subContact" for each contact with "customer"; enter details of contact, then at end we agree on NextContactDate – maybe next month, which I also enter in “subContact”
When I open frmCustomer before next contact I would like subContact to open to new contact " >*".
When subContact opens in “ >*” new I have today’s date and I would like NextContactDate now labeled AgreedContactDate for this particular customer to be displayed.
This will be significant later when reporting on how often I could get back to people on the AgreedContactDate. I’m assuming that if I can sort out the "subContact" stuff the reports will come from that. This is my main want.

I was asked by a relative to do this, and so far, (mainly) had fun.

Thanks for any help.

Josie
 
When I open frmCustomer before next contact I would like subContact to open to new contact " >*".
I understand that. The symbol represents the navigation to a new record, of course.
When subContact opens in “ >*” new I have today’s date and I would like NextContactDate now labeled AgreedContactDate for this particular customer to be displayed.
Is that what you are trying to get the DLookup function to provide for you? If so, I'm having trouble visualizing it...

Do you have some visuals for me? Snapshots? Jpegs? Whatever? :)

BTW, have you seen this?? It is one of my posts in the sample databases section. It uses the DLookup function in a subform. It is not a nested subform, and is not connected to the main by way of a relationship, but it still does the same thing that you are asking about (I think). When the function runs, it returns a random value in the field being queried (although this factor doesn't matter, because all the values are the same in the DLookup field). If you choose to look at it, the function is located under the OnClick event of the "Add Line Item" button.
 
Last edited:
thanks, will look at your code first, looks like there's a lot there for me.
 
Moving in circles

Hej ajetrumpet,
This is a jpeg of my attempt.
What I’m trying to do is populate the date from [NextProposedContactDate] into the field [ProposedContactDate] when new ContactLogDetail record is created.

When using the following I continue to get an error message saying that “you cancelled the previous operation”, sadly this is the only action generated by my code.

Using code along your lines didn’t seem to have an effect.

Me.Name of field I want populated = DLookUp("[fieldname of data from last record, this to be used in field I want ]", "table Name”, ”[ field I want populated]= Forms![mainform]![subform].Form![Name of field I want populated] ")
Thanks for your help
 

Attachments

  • aj.JPG
    aj.JPG
    55.4 KB · Views: 162
we're moving in circles!? oh no! :D :D :D I'm taking a look at it...
 

Users who are viewing this thread

Back
Top Bottom