skiphooper
Registered User.
- Local time
- Today, 02:10
- Joined
- Nov 29, 2000
- Messages
- 76
Hi all,
I have the following problem.
I start off with form A having a Public Variable as String.
During the process I load form B which has the following code in it which
loads data to a combo box. The only other code is for a close command button
which set the public variable to whatever was clicked in the combo box.
When I close form B and return to form A
the variable which is SearchChar is not set to the value clicked in the combo box.
What am I doing wrong.
The following code loades values to a combo box, which is the only thing on the form
except for the close button.
' ******************************************
Option Compare Database
' Option Explicit
' Public SearchChar As String ' defined in Txt_Input form code
Function GetDelChoice(Ind As Integer) '1234 '1234 '1234
GetDelChoice = Choose(Ind, " ,", " :", "{tab}", " ;", " #")
End Function
Function CboDataDel(fld As Control, id As Variant, _
row As Variant, col As Variant, _
code As Variant) As Variant
Static Del(5) As String, Entries As Integer
Dim ReturnVal As Variant
ReturnVal = Null
Select Case code
Case acLBInitialize ' Initialize.
Entries = 0
Del(Entries) = GetDelChoice(5)
Do Until Del(Entries) = "" Or Entries >= 5
Entries = Entries + 1
Del(Entries) = GetDelChoice(Entries)
Loop
ReturnVal = Entries
Case acLBOpen ' Open.
' Generate unique ID for control.
ReturnVal = Timer
Case acLBGetRowCount ' Get number of rows.
ReturnVal = Entries
Case acLBGetColumnCount ' Get number of columns.
ReturnVal = 1
Case acLBGetColumnWidth ' Column width.
' -1 forces use of default width.
ReturnVal = -1
Case acLBGetValue ' Get data.
ReturnVal = Del(row)
Case acLBEnd ' End.
Erase Del
End Select
CboDataDel = ReturnVal
End Function
' *****************************************
This is the code for the close command button in form B.
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
If cbodel.Value = "{tab}" Then
SearchChar = Chr(9)
DoCmd.Close acForm, "ShDelimited",acSaveYes
Exit Sub
End If
If cbodel.Value = " ," Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
If cbodel.Value = " ;" Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
If cbodel.Value = " :" Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
If cbodel.Value = " #" Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Command35_Click
End Sub
' ****************************************
Thanks in Advance
Skip
[This message has been edited by skiphooper (edited 03-08-2002).]
I have the following problem.
I start off with form A having a Public Variable as String.
During the process I load form B which has the following code in it which
loads data to a combo box. The only other code is for a close command button
which set the public variable to whatever was clicked in the combo box.
When I close form B and return to form A
the variable which is SearchChar is not set to the value clicked in the combo box.
What am I doing wrong.
The following code loades values to a combo box, which is the only thing on the form
except for the close button.
' ******************************************
Option Compare Database
' Option Explicit
' Public SearchChar As String ' defined in Txt_Input form code
Function GetDelChoice(Ind As Integer) '1234 '1234 '1234
GetDelChoice = Choose(Ind, " ,", " :", "{tab}", " ;", " #")
End Function
Function CboDataDel(fld As Control, id As Variant, _
row As Variant, col As Variant, _
code As Variant) As Variant
Static Del(5) As String, Entries As Integer
Dim ReturnVal As Variant
ReturnVal = Null
Select Case code
Case acLBInitialize ' Initialize.
Entries = 0
Del(Entries) = GetDelChoice(5)
Do Until Del(Entries) = "" Or Entries >= 5
Entries = Entries + 1
Del(Entries) = GetDelChoice(Entries)
Loop
ReturnVal = Entries
Case acLBOpen ' Open.
' Generate unique ID for control.
ReturnVal = Timer
Case acLBGetRowCount ' Get number of rows.
ReturnVal = Entries
Case acLBGetColumnCount ' Get number of columns.
ReturnVal = 1
Case acLBGetColumnWidth ' Column width.
' -1 forces use of default width.
ReturnVal = -1
Case acLBGetValue ' Get data.
ReturnVal = Del(row)
Case acLBEnd ' End.
Erase Del
End Select
CboDataDel = ReturnVal
End Function
' *****************************************
This is the code for the close command button in form B.
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
If cbodel.Value = "{tab}" Then
SearchChar = Chr(9)
DoCmd.Close acForm, "ShDelimited",acSaveYes
Exit Sub
End If
If cbodel.Value = " ," Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
If cbodel.Value = " ;" Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
If cbodel.Value = " :" Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
If cbodel.Value = " #" Then
SearchChar = Trim(cbodel.Value)
DoCmd.Close acForm, "ShDelimited", acSaveYes
Exit Sub
End If
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Command35_Click
End Sub
' ****************************************
Thanks in Advance
Skip
[This message has been edited by skiphooper (edited 03-08-2002).]