Default value for field not appearing in Form. also, how to have the Default value for one of the field to "draw" from another related-table. (1 Viewer)

tcneo

Member
Local time
Today, 19:29
Joined
Dec 7, 2021
Messages
68
Why are you prefixing combobox names with 1? Access won't like that and will have to enclose in [ ]. VBA will adjust the procedure name to use "ctl" prefix.

Probably have to change the combobox ColumnCount to 4 and ColumnWidths to 0";1";0";0"
Dear June7,

Thanks so much! It worked now. It was previously set at 2 and 0",1" respectively.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:29
Joined
Sep 21, 2011
Messages
14,051
the field is currently blank at the moment, so the field is NULL? it can't be a ZLS since it is a number? right?
TBH, I would have to test. :( though I seem to recall that could be the case.

However if you walk through your code with F8 you will see what it does.?
The code looks fine to me, so either the test is Null or nothing is in the 4th column.
Walking through the code and hovering over the variables/controls will show that once and for all?


Basic VBA debugging 101.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:29
Joined
Feb 19, 2002
Messages
42,981
Private Sub 1cboAnalyticalMethod_AfterUpdate()
If IsNull(Me.Duration_per_Qty) Then
Me.Duration_per_Qty = Me.1cboAnalyticalMethod.Column(3)
End If
End Sub
Should work if the FOURTH column of the RowSource is the one that contains duration. Remember, the columns are a zero based array so .Column(0) refers to the first column and .Column(3) refers to the fourth.

Play around and change the column number to see if you get something. Also make sure that for the row you selected the duration is NOT null.
 

Users who are viewing this thread

Top Bottom