--
Dave Hargis, Microsoft Access MVP
Darren said:
Ok thanks for the advice Not to worry about the grey boxes. I want this to be
as simpleas possible.
with regards to auto number issue. I need to have a new number allocated to
each new call that is inputed. I have all the other boxes for the relevant
info to be stored, and have even created a button that will create a new
feild in the form. I need the number to be used only once and to start at
whaterver number i like. Can you sugest anything.
You can create a fake autonumber. Each time you add a new record you can
determine the highest number currently in the field and add 1 to it. This
you do in the form's current event. You only do it for new records:
If Me.NewRecord Then
Me.txtCallNumber = Nz(DLookup("[CallNumber]", "CallTable"),0) + 1
End If
If you want to start at a specific number, put a record in the table with
the number you want to start with - 1 (I think), because the next new record
will be one higher than the value in the record you start with.
Also the date has worked fine except it comes out at 1428??? Any help would
be great.
Is the table field a date data type? Are you using any formatting on the
control?
:
--
Dave Hargis, Microsoft Access MVP
:
Many Many thanks for that.
Just a couple of other questions.
1, In a date field, is there a way of auto inserting the date?
First order of business. Forms do not have fields. Tables and queries have
fields. Forms have controls and some of those controls can be bound to
fields in the form's record source. But the short answer is if you want the
date to be today's date, put Date() in the control's Default Value property.
When you create a new record, it will automatically populate the control with
the date.
2, Also Is there a way of changing the number that a auto number starts from?
It is possible, but by asking the question, I know you are not using an
autonumber field correctly. You should not care about the value of an
autonumber and users should never see it. Autonumber field are just a tool
for creating unique value to be used as primary keys and relating tables. If
you are using it for something else, post back with what you want to do and
we can help find a better approach.
3, And on a final note now i have locked out the fields information, is
there a way of turning the feild boxes grey for example?
Yes, but it take a lot more code because you have to go through the controls
collection of the form and set each editable control's Enabled property to
False.
Many thanks again
:
In the Click Event of the command button:
With Me
.AllowEdits = False
.AllowDeletions = False
End With
The other thing will be to allow them back on. You could either use toggle
buttons in an option group to turn it on and off or you can put the same code
in the Form Current event except replace False with True. With this method,
whenever you move to a different or new record, editing will be allowed
again until the button is clicked.
--
Dave Hargis, Microsoft Access MVP
:
I have created a small call logging database on access. i want to create a
button that when pressed will lock all of the information in the feilds. I am
very new to this so any help would be great.