Unable to perform dcount (1 Viewer)

lookforsmt

Registered User.
Local time
Today, 08:58
Joined
Dec 26, 2011
Messages
672
HI! i have managed to get the desired results but may not be the correct method

i have attached the updated db. Just one final check on the before update event
on field chqbrcd on the mainform. If anyone can help me to restrict input of number as 1st two characters. The code is already there i just need to change it
 

Attachments

  • FieldValidation_2c.accdb
    528 KB · Views: 156

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:58
Joined
Aug 30, 2003
Messages
36,118
I'm not clear on the question. The only code I see right off dealing with first two characters is on the subform, not the main form.
 

lookforsmt

Registered User.
Local time
Today, 08:58
Joined
Dec 26, 2011
Messages
672
Hi! pbaldy, i have moved the beforeupdate event to the main form on field name "searchFor" but i am not able to get the result.

I am looking for matching the below:

The user will input the "duedateFor" and "chqbrcd" on the mainform and input in field "creditAccount_ac" on subform. If the same is matching in "tbl_DailyData" then it will accept or else it will pop-up msg as invalid input.

Before that when capturing "chqbrcd" if the starting alphabet is not "EN" then it popup msg as invalid input

hope the above is clear.
 

lookforsmt

Registered User.
Local time
Today, 08:58
Joined
Dec 26, 2011
Messages
672
HI! i managed to get the name displayed on the main form from the table.

accountName_ac.Value = DLookup("[ACName]", "[tbl_DailyData]", "chqbrcd =" & Chr(34) & SearchFor.Value & Chr(34))

What if i want to add some more fields from the same table on to the main form. How can i write this code.
Any sugggestions
 

Cronk

Registered User.
Local time
Today, 15:58
Joined
Jul 4, 2013
Messages
2,770
If your aim is to ensure that there is no more than one record with the same values in DueDate, CreditAC, and chqbrcd, I would create a unique index using all three fields.

Access will then prevent a duplicate being saved in the table.
 

lookforsmt

Registered User.
Local time
Today, 08:58
Joined
Dec 26, 2011
Messages
672
The idea is for the user to input some of the fields and view some of the fields on an unbound field. I managed to apply the same code to the other fields to be visible on form.

I may not be doing this project in a structured way, but as long as i am getting my result, it fine for the moment, but i may look at it once i get this completed.

Thanks for suggestion.
 

Cronk

Registered User.
Local time
Today, 15:58
Joined
Jul 4, 2013
Messages
2,770
I know what you mean about the end is more important than the means. I have been known to knock a nail in using the head of a pair of pliers (seriously) - works but not the best way.
 

Users who are viewing this thread

Top Bottom