benkingery
Registered User.
- Local time
- Yesterday, 18:16
- Joined
- Jul 15, 2008
- Messages
- 153
I have a variable I need to populate with a value and in turn populate a field on a form with that variable value.
The value I want to set the variable to is the result of this query:
What i currently have is this:
I'm struggling with this. I'm new to this type of coding. Anyone offer some solution?
Thanks in advance.
The value I want to set the variable to is the result of this query:
Code:
SELECT TOP 1 WarehouseLocation.LocationCode FROM WarehouseLocation WHERE (WarehouseLocation.CurrentUnits < WarehouseLocation.MaxUnits) AND (LocationCode Like 'LT*') ORDER BY LocationCode
What i currently have is this:
Code:
Dim SelectedLocationSQL As String
Dim SelectedLocation As String
SelectedLocationSQL = "SELECT TOP 1 WarehouseLocation.LocationCode FROM WarehouseLocation WHERE (WarehouseLocation.CurrentUnits < WarehouseLocation.MaxUnits) AND (LocationCode Like 'LT*') ORDER BY LocationCode"
SelectedLocation = CurrentProject.Connection.Execute("SelectedLocationSQL").Fields(0).Value
Me.Location = SelectedLocation
I'm struggling with this. I'm new to this type of coding. Anyone offer some solution?
Thanks in advance.