Populating a field on a form from static table

D

David

I need help in populating a field from a static table into an empty
field on my main table so that I can bring in defaults. I have been
successful with the first two fields, but the third one -
tblRetToWkMain.BalancingNewInj will not populate.
tblRetToWkMain.DiagSpecsNewInj and tblRetToWkMain.Weight2NewInj
populate fine. What am I doing wrong on the third one that will not
allow it to populate? Thanks so much for any help you can give me.
David

Private Sub cboDiagIDNewInj_AfterUpdate()
Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
End If
If [tblDiagnosisNewInj.BalancingNewInj] = Not Null Then
Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
End If
End Sub
 
M

Mr B

David,

Try changing to this:

Private Sub cboDiagIDNewInj_AfterUpdate()
Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
End If
If not IsNull([tblDiagnosisNewInj.BalancingNewInj]) Then
Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
End If
End Sub
 
D

David

David,

Try changing to this:

Private Sub cboDiagIDNewInj_AfterUpdate()
    Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
  If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
    Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
  End If
  If not IsNull([tblDiagnosisNewInj.BalancingNewInj]) Then
    Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
  End If
End Sub

--
HTH

Mr B
askdoctoraccess dot com



David said:
I need help in populating a field from a static table into an empty
field on my main table so that I can bring in defaults. I have been
successful with the first two fields, but the third one -
tblRetToWkMain.BalancingNewInj will not populate.
tblRetToWkMain.DiagSpecsNewInj and tblRetToWkMain.Weight2NewInj
populate fine. What am I doing wrong on the third one that will not
allow it to populate? Thanks so much for any help you can give me.
David
Private Sub cboDiagIDNewInj_AfterUpdate()
    Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
  If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
    Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
  End If
  If [tblDiagnosisNewInj.BalancingNewInj] = Not Null Then
    Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
  End If
End Sub- Hide quoted text -

- Show quoted text -

Thanks for responding Mr B. When I run yours, I get an error msg.
saying run-time error '3163'; the field is too small to accept the
amount of data you attempted to add. Try inserting or pasting less
data.
The debug goes to the line of code:
Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
I know this cannot be correct, because the field only has a field size
of 1, which brings in either an O or F or N.
 
M

Mr. B

David,

The only line that I changed was this line:
If not IsNull([tblDiagnosisNewInj.BalancingNewInj]) Then
All of the other code is just as you had it. I would not have any idea
about the field size.

Good luck

Mr. B
askdoctoraccess dot com

David said:
David,

Try changing to this:

Private Sub cboDiagIDNewInj_AfterUpdate()
Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
End If
If not IsNull([tblDiagnosisNewInj.BalancingNewInj]) Then
Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
End If
End Sub

--
HTH

Mr B
askdoctoraccess dot com



David said:
I need help in populating a field from a static table into an empty
field on my main table so that I can bring in defaults. I have been
successful with the first two fields, but the third one -
tblRetToWkMain.BalancingNewInj will not populate.
tblRetToWkMain.DiagSpecsNewInj and tblRetToWkMain.Weight2NewInj
populate fine. What am I doing wrong on the third one that will not
allow it to populate? Thanks so much for any help you can give me.
David
Private Sub cboDiagIDNewInj_AfterUpdate()
Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
End If
If [tblDiagnosisNewInj.BalancingNewInj] = Not Null Then
Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
End If
End Sub- Hide quoted text -

- Show quoted text -

Thanks for responding Mr B. When I run yours, I get an error msg.
saying run-time error '3163'; the field is too small to accept the
amount of data you attempted to add. Try inserting or pasting less
data.
The debug goes to the line of code:
Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
I know this cannot be correct, because the field only has a field size
of 1, which brings in either an O or F or N.
 
D

David

David,

The only line that I changed was this line:
If not IsNull([tblDiagnosisNewInj.BalancingNewInj]) Then
All of the other code is just as you had it.  I would not have any idea
about the field size.

Good luck

Mr. B
askdoctoraccess dot com



David said:
David,
Try changing to this:
Private Sub cboDiagIDNewInj_AfterUpdate()
    Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
  If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
    Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
  End If
  If not IsNull([tblDiagnosisNewInj.BalancingNewInj]) Then
    Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
  End If
End Sub
--
HTH
Mr B
askdoctoraccess dot com
:
I need help in populating a field from a static table into an empty
field on my main table so that I can bring in defaults. I have been
successful with the first two fields, but the third one -
tblRetToWkMain.BalancingNewInj will not populate.
tblRetToWkMain.DiagSpecsNewInj and tblRetToWkMain.Weight2NewInj
populate fine. What am I doing wrong on the third one that will not
allow it to populate? Thanks so much for any help you can give me.
David
Private Sub cboDiagIDNewInj_AfterUpdate()
    Me.[tblRetToWkMain.DiagSpecsNewInj] =
[tblDiagnosisNewInj.DiagSpecsNewInj] & " " & " "
  If [tblDiagnosisNewInj.Weight2NewInj] >= 1 Then
    Me.[tblRetToWkMain.Weight2NewInj] =
[tblDiagnosisNewInj.Weight2NewInj] & " " & " "
  End If
  If [tblDiagnosisNewInj.BalancingNewInj] = Not Null Then
    Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
  End If
End Sub- Hide quoted text -
- Show quoted text -
Thanks for responding Mr B. When I run yours, I get an error msg.
saying run-time error '3163'; the field is too small to accept the
amount of data you attempted to add. Try inserting or pasting less
data.
The debug goes to the line of code:
  Me.[tblRetToWkMain.BalancingNewInj] =
[tblDiagnosisNewInj.BalancingNewInj] & " " & " "
I know this cannot be correct, because the field only has a field size
of 1, which brings in either an O or F or N.- Hide quoted text -

- Show quoted text -

Thanks anyway Mr. B. I appreciate it.
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top