PC Review


Reply
Thread Tools Rate Thread

How Do I Insert Value from one Field into a different field

 
 
=?Utf-8?B?Tmljb2xlIE1vbmNoYW1w?=
Guest
Posts: n/a
 
      23rd Jan 2006
I have a database that contains both starting and ending mileages.
What I would like to do is have the data entry from show the default entry
for the starting mileage be the ending mileage from the last record.

I also need to be able to override this default in case the number changes
for some reason.

I have tried a Dlookup function and have not had any luck.

Nicole
 
Reply With Quote
 
 
 
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      23rd Jan 2006
On the form Load event you can set the default

Me.starting.DefaultValue = DlookUp("Start FieldName","TableName","[Key
fieldName] = " & DMax("[Key fieldName]","[TableName]"))

Me.ending.DefaultValue = DlookUp("End FieldName","TableName","[Key
fieldName] = " & DMax("[Key fieldName]","[TableName]"))
=================================
The Dmax is used to bring the last record entered, you need to change the
[Key fieldName] to the name of the field that indicate which field was the
last to be entered.
=================================
On the After update event of the form, you need to add the code that check
if the value changed, if it did, it will change the default

If Me.starting.DefaultValue <> Me.starting Then
Me.starting.DefaultValue = Me.starting
End If
If Me.ending.DefaultValue <> Me.ending Then
Me.ending.DefaultValue = Me.ending
End If

--
\\// Live Long and Prosper \\//
BS"D


"Nicole Monchamp" wrote:

> I have a database that contains both starting and ending mileages.
> What I would like to do is have the data entry from show the default entry
> for the starting mileage be the ending mileage from the last record.
>
> I also need to be able to override this default in case the number changes
> for some reason.
>
> I have tried a Dlookup function and have not had any luck.
>
> Nicole

 
Reply With Quote
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      23rd Jan 2006
Use an unbound textbox on your data entry form that pulls the last mileage.
Then have your bound textbox (starting mileage) default to the value in the
unbound textbox.

"Nicole Monchamp" wrote:

> I have a database that contains both starting and ending mileages.
> What I would like to do is have the data entry from show the default entry
> for the starting mileage be the ending mileage from the last record.
>
> I also need to be able to override this default in case the number changes
> for some reason.
>
> I have tried a Dlookup function and have not had any luck.
>
> Nicole

 
Reply With Quote
 
Phillip Windell
Guest
Posts: n/a
 
      23rd Jan 2006
In the Form's "OnLoad" event use the following Select statement pattern to
get the startmilage from the Record with the highest Date.

SELECT Top 1<startmileage> FROM <table> ORDER BY <date> ASC

Then apply it to the value of the Text Box on the Form, something along the
lines of:

txtStartMileage.text = <startmileage>

My knowledge of VB and SQL is "generic" in nature and my knowledge of the
specifics of Access is limited. Sorry I can't be more specific than this,
but it should point you in the right direction.

--
Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com


"Nicole Monchamp" <(E-Mail Removed)> wrote in
message news:20DA783E-B2A6-48CB-BAB0-(E-Mail Removed)...
> I have a database that contains both starting and ending mileages.
> What I would like to do is have the data entry from show the default entry
> for the starting mileage be the ending mileage from the last record.
>
> I also need to be able to override this default in case the number changes
> for some reason.
>
> I have tried a Dlookup function and have not had any luck.
>
> Nicole



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert FIELD or ASK field - Help required! Lynn Stark, Mississauga, ON Microsoft Word Document Management 1 19th Jun 2008 04:53 PM
How do I insert a mailmerge field in the To field of an email? =?Utf-8?B?VG9tQVdlYmI=?= Microsoft Outlook Discussion 1 21st Aug 2007 05:30 PM
Re: Insert a value of an unbound field into a table field. Rick Brandt Microsoft Access Form Coding 0 2nd Jun 2007 04:11 PM
How to insert a field in Access when field is not in chooser? =?Utf-8?B?R2VvZmY=?= Microsoft Access Getting Started 2 28th Aug 2006 04:28 PM
How can I insert a new field between Existing field? Alex AU Microsoft Access VBA Modules 5 10th Aug 2006 02:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:09 AM.