How to memorize a value of a textbox

Sniper-BoOyA-

Registered User.
Local time
Today, 09:14
Joined
Jun 15, 2010
Messages
204
Good Morning,

Currently i am working on a database which can be use to register incomming samples.

Ive made a form, where the user has to enter a serial number, which belongs to the project the sample is from.

But a lot of times a project has multipal samples.

Which gives me the following "problem":

- I need to make a new record.
- When i go to the new record the SerialNumber field is empty again.

My solution (well i thought it was)

- Add a checkbox on the form.
- Assign SerialNumber as a Public String in VBA
- On the afterupdate event of the checkbox i did the following:

Code:
 Select Case checkbox
 
Case True
 
 SerialNumber=me.serialnumber.value
 
Case Else
 
SerialNumber = ""
 
End Select

- And my next idea was to give me.serialnumber the default value of the string serialnumber..

But it doesnt work at all. In fact the form wont even launch anymore.

Am i doing this completely wrong, or am i in the right direction?
 
I think you should do this as a form/subform. So the project serial number is in the form and the samples go in the subform. This might mean you need to create a table for Projects if you haven't already.

Access will automatically populate the serial number for the child records.

hth
Chris
 
If the serial number is the same for all samples within a project then shouldn't it be a field in the project table rather than duplicated in each sample record?

Or is that the PK / FK field which links the 2 tables, in which case I agree with the form / subform suggestion above.
 

Users who are viewing this thread

Back
Top Bottom