Option Compare Database
Option Explicit
Dim db As Long
Private Sub cboWeight_AfterUpdate()
Me![GCResult] = DLookup("GC", "TblAll", "[Weight] = '" & cboWeight & "'")
End Sub
Private Sub Form_Current()
On Error Resume Next
Dim strCountry As String
If IsNull(cboWeight.Value) Then
grpCountry.Value = Null
End If
' Synchronise country combo with existing city
strCountry = DLookup("[Letter]", "tblAll", "[City]='" & cboWeight.Value & "'")
Select Case strCountry
Case "A"
grpCountry.Value = 1
Case "B"
grpCountry.Value = 2
Case "C"
grpCountry.Value = 3
Case "D"
grpCountry.Value = 4
End Select
' Synchronise city combo with existing city
cboWeight.RowSource = "Select tblAll.Weight " & _
"FROM tblAll " & _
"WHERE tblAll.Letter = '" & strCountry & "' " & _
"ORDER BY tblAll.Weight;"
End Sub
Private Sub Form_Load()
'"DELETE FROM tblData WHERE [Name]=GC"
End Sub
Private Sub grpCountry_AfterUpdate()
On Error Resume Next
Dim strCountry As String
Select Case grpCountry.Value
Case 1
strCountry = "A"
Case 2
strCountry = "B"
Case 3
strCountry = "C"
Case 4
strCountry = "D"
End Select
cboWeight.RowSource = "Select tblAll.Weight " & _
"FROM tblAll " & _
"WHERE tblAll.Letter = '" & strCountry & "' " & _
"ORDER BY tblAll.Weight;"
End Sub