Where would I put code I tried in on load event each way. Run time error 2248, how do you bind in option 1
thanks for your help,
Where would I put code I tried in on load event each way. Run time error 2248, how do you bind in option 1
thanks for your help,
It opens to new record so shows me.contractor = null
Binding a control is just setting the ControlSource property to a field of the RecordSource, just as you have done with other textboxes in the Detail section.
The code will go in the Load event, same as you have for setting value of the other textboxes.
Contractor field in ProjectHours table is number type. The value in txtContract is text. If you want to save the Contractor ID then need to pull that value over to the form.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Use Design View ofyour form vs. using Layout View.
I am getting closer, here is sql
SELECT [Project Hours].*, [Project Hours].Contractor
FROM [Project Hours]
WHERE ((([me].[Contractor])=[Me].[txtContractor])); this is how I was trying to get contractor to go to Project Hours table, but did not work no error codes.
in detail I have contractor =[txtContractor]
Private Sub Form_Load()
Dim iEdit As Integer
'populate the text boxes
Me.txtName = Environ("username")
Me.txtDate = Date
Me.txtContractor = DLookup("Contractor", "Contractors", "Login='" & Forms!FrmMenu!txtUser & "'")
'set edit permissions
iEdit = Forms!FrmMenu!txtLevel.Value
Select Case iEdit
Case Is < 2
Me.AllowEdits = False
Case Else
Me.AllowEdits = True
End Select
End Sub
This pulls info to form correctly. But the field in form header txtcontractor is still unbound, tried all combinations any thoughts thanks
You haven't followed the instructions.
Set the Contractor textbox ControlSource property in the Properties Sheet with field name from the RecordSource.
You don't show the additional code in the procedure to populate Contractor textbox.
However, there is a conflict of datatypes as noted in post 18.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.