Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
This means any forms, queries and reports accessing the table/s of interest, [blue]will have to be closed![/blue] When the Defaults Form is finally closed, [purple]what form to open in its place has to be decided upon[/purple], otherwise the [blue]database window may be exposed bare[/blue].TheAceMan said:[blue]In order to directly edit properties of a table, the executing code must have sole access . . .[/blue]
Then in your last post:[blue] Each person using it has an individual copy of the database on their laptops. [purple]Everybody uses different variables[/purple] like labor rates, tax rates, ect.[/blue]
Your requirement of [blue]Independent Defaults[/blue] makes the networking issue invalidate changing [blue]Table Defaults[/blue]. Since the tables on a network are common, independency is lost. Also be aware: if the database on the network is not a split database then you can't set independent defaults without having an equivalent table for each user. So what I may/maynot be able to depends on the following question:[blue]One possible problem with this is there are some equations where the database is on a network and [purple]two or three users could be on the same database at once[/purple], preventing sole access.[/blue]
BMcMakins said:Each person using it has an individual copy of the database on their laptops
An [blue]unbound form[/blue] is a form with no [blue]RecordSource[/blue] (displays no records). When you make the form, in the [blue]Forms Window[/blue] just click [purple]New[/purple].BMcMakin said:[blue]I don't understand what you mean about constucting an [purple]unbound form[/purple].[/blue]
You can group select those that are common and set it once for all in the group. [purple]Be careful of spelling, we don't want to have problems due to typo's![/purple]TheAceMan said:[blue]For each textbox that holds a default value, in the [purple]TagProperty[/purple] your going to enter the table & field name in the following format:
[purple][TableName].[FieldName][/purple][/blue]
[blue]Public Sub DefaultsHandler(Sav As Boolean)
Dim db As DAO.Database, ctl As Control
Dim tdf As DAO.TableDef, fld As Field, Prp As Property
Dim tblName As String, fldName As String
Dim Idx As Integer, Typ As Integer
Dim Msg As String, Style As Integer, Title As String, DL As String
DL = vbNewLine & vbNewLine
If Sav Then
Msg = "Are you sure you want to Save Defaults?" & DL & _
"Saving will overwrite current settings!" & DL & _
"Click 'Yes' to save defaults." & DL & _
"Click 'No' to abort"
Style = vbQuestion + vbYesNo
Title = "Save Defaults Confirmation . . ."
If MsgBox(Msg, Style, Title) = vbNo Then Exit Sub
End If
Set db = CurrentDb()
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox And Len((ctl.Tag) & "") > 0 Then
DoCmd.Hourglass True
Idx = InStr(1, ctl.Tag, ".")
tblName = Left(ctl.Tag, Idx - 1)
fldName = Right(ctl.Tag, Len(ctl.Tag) - Idx)
Set fld = db.TableDefs(tblName).Fields(fldName)
Set Prp = fld.Properties("DefaultValue")
Typ = fld.Type
If Sav Then [green]'Save Defaults[/green]
If Len(Trim(ctl) & "") > 0 Then
If Typ = dbText Then [green]'Text[/green]
Prp = """" & ctl & """"
ElseIf Typ = dbDate Then [green]'Date/Time[/green]
Prp = "#" & ctl & "#"
Else
Prp = Val(ctl) [green]'Numeric[/green]
End If
Else
Prp = "" [green]'No Data[/green]
End If
Else [green]'Load Defaults[/green]
If (Typ = dbText Or Typ = dbDate) And Len(Trim(Prp) & "") > 0 Then
ctl = Mid(Prp, 2, Len(Prp) - 2) [green]'strip " & #[/green]
Else
ctl = Prp
End If
End If
DoCmd.Hourglass False
End If
Next
Set fld = Nothing
Set db = Nothing
End Sub[/blue]
[blue] Call DefaultsHandler(False)[/blue]
[blue] Call DefaultsHandler(True)[/blue]