Default value in Form field (1 Viewer)

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
You could try something like:
Code:
=DLookup("ExchangeRateID";"ExchangeRateT";"ExchangeRateDate=#" &
Format(DMax("ExchangeRateDate";"ExchangeRateT","CurrencyID=" & [CurrencyID]),"yyyy-mm-dd") & "#")
(untested)
Hope it helps...
Thanks, tried but the combobox stays empty... :unsure:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:03
Joined
Oct 29, 2018
Messages
11,985
Hi. Try this one:
Code:
=DLookUp("ExchangeRateID","ExchangeRateT","ExchangeRateDate=#" & 
Format(DMax("ExchangeRateDate","ExchangeRateT","CurrencyID=" & [CurrencyIDcbo]),"yyyy-mm-dd") & "#")
 

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
Hi. Try this one:
Code:
=DLookUp("ExchangeRateID","ExchangeRateT","ExchangeRateDate=#" &
Format(DMax("ExchangeRateDate","ExchangeRateT","CurrencyID=" & [CurrencyIDcbo]),"yyyy-mm-dd") & "#")
getting a
1583352992848.png
 

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
Hi. Congratulations! Glad to hear it worked for you. You're very welcome and good luck with your project.
Can I ask you one more question please?
I notice that on my form the cascading isn't working anymore, trying to figure that out, it keeps saying

1583420177676.png
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:03
Joined
Oct 29, 2018
Messages
11,985
Can I ask you one more question please?
I notice that on my form the cascading isn't working anymore, trying to figure that out, it keeps saying

View attachment 79600
Hi. I'm not in front of a computer now, but I'll take a look later. Can you post a copy of the non-working db?
Sent from phone...
 

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
Hi. I'm not in front of a computer now, but I'll take a look later. Can you post a copy of the non-working db?
Sent from phone...
Thanks, I've attached the dbse. It's in the same form as we discussed the default value for the ExchangeRateID field.
.When I scroll between the records, the ExchangeRateID field remains empty when USD is selected in the above CurrencyID field, when I select the field I can select the exchange rates though. Something wrong with the requery and combo dropdown. Trying to get the ExchangeRateID combobox to drop down only when it has the focus (selected) and not when scrolling between records.

1583425048507.png
 

Attachments

theDBguy

I’m here to help
Staff member
Local time
Today, 09:03
Joined
Oct 29, 2018
Messages
11,985
Thanks, I've attached the dbse. It's in the same form as we discussed the default value for the ExchangeRateID field.
.When I scroll between the records, the ExchangeRateID field remains empty when USD is selected in the above CurrencyID field, when I select the field I can select the exchange rates though. Something wrong with the requery and combo dropdown. Trying to get the ExchangeRateID combobox to drop down only when it has the focus (selected) and not when scrolling between records.

View attachment 79602
Hi. I found two things off with your last db. Check out the attached to see if it works again. Then, if you can explain to us what you were trying to do with the code I removed, maybe we can help you add them back in.
 

Attachments

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
hi,

Thanks for looking at my dbse once more. I was trying to solve the below problem which happens when I open the form and select the exchangerateID field. Only when I select the CurrencyID field and select a currency and then go to the ExchangeRateID, it will show the selected currency exchange rates, however a USD value remains empty. That's why I was looking at the Form for an on current event.
I was following a tutorial video from ALZ.com (added OneDrive link to the video):

1583500406955.png
OneDrive link to the video (zip)
 

jdraw

Super Moderator
Staff member
Local time
Today, 12:03
Joined
Jan 23, 2006
Messages
13,310
I see this is post#33 and there is no indication that your issue is solved.
Can you please tell us -using the sample graphic you have attached - what exactly do you want to occur? Please be explicit:
-when this form opens, it should vvvvvv...
-when I select a value in XXX, then YYY should occur
-???
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:03
Joined
Oct 29, 2018
Messages
11,985
I see this is post#33 and there is no indication that your issue is solved.
Can you please tell us -using the sample graphic you have attached - what exactly do you want to occur? Please be explicit:
-when this form opens, it should vvvvvv...
-when I select a value in XXX, then YYY should occur
-???
Hi. I could be wrong, but I think the original question about Default Value is solved. I think this is about Cascading Combobox now.
 

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
I see this is post#33 and there is no indication that your issue is solved.
Can you please tell us -using the sample graphic you have attached - what exactly do you want to occur? Please be explicit:
-when this form opens, it should vvvvvv...
-when I select a value in XXX, then YYY should occur
-???
Hi Jdraw,👋

Thanks for offered help. :) (y)
I'm trying to concatenate the comboboxes: CurrencyID and ExchangeRateID.
They are working fine when I open the form and select a currency in the CurrencyID combobox field.
However, when I open the form and select the ExchangeRateID for another value, for instance the currency rate of the next month (a purchase entered in the database on 25th of February for example will have the exchange rate code for February 2020 but when the invoice arrives 02nd of March, the cost will be booked under the March 2020 exchange rate - hence why I list the ExchangeRates and have the option to chose a month from the combobox) then it shows me all the exchange rates from all the currencies, which is not correct. Also I notice that when USD was selected in the CurrencyID combobox that it doesn't show the exchange rates in the ExchangeRateID combobox?
The ExchangeRateID combobox should only list the exchange rates based on the selected currency in the CurrencyID combobox. I was looking at a video tutorial from Richard Rost (Access Learning Zone.com ), perhaps you heard from him, on the issue and was trying to add an On Current event on the form to fix this but without any luck, I'm doing something wrong but can't figure it out...? :confused:
 

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
Hi. I could be wrong, but I think the original question about Default Value is solved. I think this is about Cascading Combobox now.
Yes, that's correct, the default value got solved, but concatenation didn't work anymore after that, since DBguy, knew the background having look at the database, I asked him for help to avoid posting the whole story once again in a new post....
 

jdraw

Super Moderator
Staff member
Local time
Today, 12:03
Joined
Jan 23, 2006
Messages
13,310
Thanks dbGuy (Leo I believe) and Siegfried -yes I've heard of and often suggest videos by Richard Rost(599CD).
Yes I think the OP has hit another issue, not related to the default value, but in his processing logic/same form. I was looking for some specifics on latest issue which you and OP have provided-thanks. I'll look at your attached file in post #32, but I have not followed the thread in any detail.
 

Siegfried

Registered User.
Local time
Today, 18:03
Joined
Sep 11, 2014
Messages
105
Hi Jdraw,👋

Thanks for offered help. :) (y)
I'm trying to concatenate the comboboxes: CurrencyID and ExchangeRateID.
They are working fine when I open the form and select a currency in the CurrencyID combobox field.
However, when I open the form and select the ExchangeRateID for another value, for instance the currency rate of the next month (a purchase entered in the database on 25th of February for example will have the exchange rate code for February 2020 but when the invoice arrives 02nd of March, the cost will be booked under the March 2020 exchange rate - hence why I list the ExchangeRates and have the option to chose a month from the combobox) then it shows me all the exchange rates from all the currencies, which is not correct. Also I notice that when USD was selected in the CurrencyID combobox that it doesn't show the exchange rates in the ExchangeRateID combobox?
The ExchangeRateID combobox should only list the exchange rates based on the selected currency in the CurrencyID combobox. I was looking at a video tutorial from Richard Rost (Access Learning Zone.com ), perhaps you heard from him, on the issue and was trying to add an On Current event on the form to fix this but without any luck, I'm doing something wrong but can't figure it out...? :confused:
Hi, Any suggetions on this concatention issue?
Thanks.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom