Blueice13085
asked on
MS ACCESS Default Value help
i have a db in .mde format. form with a field called Truck #, DriverName, StartMiles, etc..... table where data is stored Drivers_Log... what i want is on the form if i double click on a field it will pop up and say Please Enter Default Value for Truck #. the value u enter will be the default value for that field. so when i cluck on new Record the default value will be what i put in the input box.
ASKER
well i have the mdb, final will be mde
To expanded on capricorn1's reply;
The MDB is the source database. It has all the VBA source code. You can modify the form, reports, and Modules. The .MDB is the "master" or "Source code".
You create an MDE from a MDB. When you compile a MDB into an MDE file all the VBA source code is removed. Only the compiled code is left in the new MDE file.
It is very important to keep the MDB file in a safe place.
If you do not the MDE and do not have the MDB then you might not have permission to make changes
The MDB is the source database. It has all the VBA source code. You can modify the form, reports, and Modules. The .MDB is the "master" or "Source code".
You create an MDE from a MDB. When you compile a MDB into an MDE file all the VBA source code is removed. Only the compiled code is left in the new MDE file.
It is very important to keep the MDB file in a safe place.
If you do not the MDE and do not have the MDB then you might not have permission to make changes
To expanded on capricorn1's reply;
The MDB is the source database. It has all the VBA source code. You can modify the form, reports, and Modules. The .MDB is the "master" or "Source code".
You create an MDE from a MDB. When you compile a MDB into an MDE file all the VBA source code is removed. Only the compiled code is left in the new MDE file.
It is very important to keep the MDB file in a safe place.
If you do not the MDE and do not have the MDB then you might not have permission to make changes
The MDB is the source database. It has all the VBA source code. You can modify the form, reports, and Modules. The .MDB is the "master" or "Source code".
You create an MDE from a MDB. When you compile a MDB into an MDE file all the VBA source code is removed. Only the compiled code is left in the new MDE file.
It is very important to keep the MDB file in a safe place.
If you do not the MDE and do not have the MDB then you might not have permission to make changes
don'y know why you need it that way, you can set the default value in the design view of the table and/or form.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
GET A error using this
Private Sub NAME_AfterUpdate()
Me.NAME.DefaultValue = Chr(34) & Me.NAME & Chr(34)
End Sub
Private Sub NAME_AfterUpdate()
Me.NAME.DefaultValue = Chr(34) & Me.NAME & Chr(34)
End Sub
Name is actually a property of the control and should not be used as the control's name
I would change the control's name to be txtName.
You could also try this:
I would change the control's name to be txtName.
You could also try this:
Private Sub NAME_AfterUpdate()
Me.[NAME].DefaultValue = Chr(34) & Me.[NAME] & Chr(34)
End Sub
ASKER
no that still didn't work , guess i will have to do the long process of changing the name to driver or something like that just means i have to change it in every form, report, & query
The issue is not with the field name in the table but with the control name for the text box.
You do not have to change the field name int eh table.
Try a test on just one form: change the text box 's Name property to something like txtDriverName.
Then try the code:
When you edit the forms to make this change you would also rename the control at the time. You would only have to do this on the forms where you want to set the default value. You do not have to change any reports or queries since they will not need the VBA code to set the default value.
You do not have to change the field name int eh table.
Try a test on just one form: change the text box 's Name property to something like txtDriverName.
Then try the code:
Private Sub NAME_AfterUpdate()
Me.[txtDriverNAME].DefaultValue = Chr(34) & Me.[txtDriverNAME] & Chr(34)
End Sub
When you edit the forms to make this change you would also rename the control at the time. You would only have to do this on the forms where you want to set the default value. You do not have to change any reports or queries since they will not need the VBA code to set the default value.
you have to get the .mdb version to add this feature