Continious Form-New Record

hardhitter06

Registered User.
Local time
Today, 16:19
Joined
Dec 21, 2006
Messages
600
Hi All,

I'm using Access 2003.

I have a continious form (that allows additions) with 5 fields where the record is retrieved by searching a Acct# field.

When I go to add a new record after searching this field, Access by default makes all the fields blank for the new record/data to be added.

What I would like is to keep the Acct# so the user will not have to retype (in reality, avoid error) and just add the data to the other 4 fields.

Is there a way to do this?
 
Can you just create a STOREACCT# button to save the Acct# to a variable and load it back, or when click on the button, set the acct# default value to that particular acct#?
 
Ya, you can set the DefaultValue property of the control. This property requires a string value so I believe you need put quotes around it. It's fairly common practice to do this during the Current event of the object on which the subform depends.
Code:
Private Sub Form_Current()
  Me.Subform.Form.Control.DefaultValue = "=" & chr(34) & Me.SomeValue & chr(34)
End Sub
It's worth noting also that this is not required on a field that serves as a link between a subform and its parent. That is handled automatically by Access.
 
That sounds like it could work, do you know how to set that up though, little confused?
 
I'm kind of new to coding lag, with your code, what do I need to edit from it so that it will work with my DB?
 
As Lagbolt suggested,
1. go to your form property
2. Click on Event tab
3. Click on On Current event (...)
4. Choose Builder -> Code Builder

Then enter something like

Me.AcctNo.DefaultValue = "=" & Chr(34) & Me.AcctNo & Chr(34)
 
You guys rock.

Sorry, I'm not always great with the terminology so I needed it put in "dummy" steps.

Thank you so much tho!
 
As Lagbolt suggested,
1. go to your form property
2. Click on Event tab
3. Click on On Current event (...)
4. Choose Builder -> Code Builder

Then enter something like

Me.AcctNo.DefaultValue = "=" & Chr(34) & Me.AcctNo & Chr(34)

This example assumes you are updating a Control on the current form named AcctNo. If that is the name of the Control, then it will work as it is posted. If it is NOT the name of the Control, then you will need to make the appropriate substitution for the correct Control name.
 
Yes MSAccess, I didn't want it to seem like I was duplicatingthreads, but that was part 1 for "UNSPSC code" on my other thread you were helping me with. Now I just need the amt error part...
 
Hi Guys,

This is working great unless a user searches a number that isn't in the database yet. Instead of showing what it searched or nothing, it shows "11112222". That is one of my test records, but how can I get it to show what I'm searching for even if it doesn't exist?
 

Users who are viewing this thread

Back
Top Bottom