I'm sure this is not correct but maybe you can see what I am trying to do.
Public Function CommandExecute(CommandNumber As Integer)
Dim strSQL As String
strSQL = Forms![frmAlarms]![txtFunctionName].RowSource = CommandExecute & Me.CommandNumber
SQL Statement, One More Time
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: SQL Statement, One More Time
Or:
Public Function mySetSec(frmName As String)
Dim stLinkCriteria As String
stLinkCriteria = "[txtFunctionName] = " & "'" & txtFunctionName & "'"
frmName = frmAlarms
Select Case (TempVars!strFunctionName)
Case 1
DoCmd.Beep
Public Function mySetSec(frmName As String)
Dim stLinkCriteria As String
stLinkCriteria = "[txtFunctionName] = " & "'" & txtFunctionName & "'"
frmName = frmAlarms
Select Case (TempVars!strFunctionName)
Case 1
DoCmd.Beep
-
- Administrator
- Posts: 78675
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SQL Statement, One More Time
I'm afraid that neither post makes sense to me, sorry. I have no idea what you are trying to do.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: SQL Statement, One More Time
Ok. Thanks. I will continue to search for a way or an answer.
Again, Many Thanks.
Again, Many Thanks.
-
- Administrator
- Posts: 78675
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SQL Statement, One More Time
It would be better if you explained what you want to do, instead of posting random bits of code...
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: SQL Statement, One More Time
Ok, simple: Is it possible to populate a combobox with values from a module?
I just need to know if it is or not. Then can proceed.
I just need to know if it is or not. Then can proceed.
-
- Administrator
- Posts: 78675
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SQL Statement, One More Time
The generic answer is "yes", but I'd need detailed information for a more specific response.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: SQL Statement, One More Time
One table: tblAlarms
AlarmID = PK
AlarmTime = Date/Time
FunctionName = Text
1 form; frmAlarms
4 fields:
txtAlarmTime
txtFunctionName
btnAddAlarm
lstAlarms which is a listbox that shows the added alarms.
1. set alarm time via txtAlarmTime
2. add text or vba command to run
3. click btnAddAlarm and run the code in the module if vba command, else display text on timed event
4. lstAlarms displays the alarms that have been added.
AlarmID = PK
AlarmTime = Date/Time
FunctionName = Text
1 form; frmAlarms
4 fields:
txtAlarmTime
txtFunctionName
btnAddAlarm
lstAlarms which is a listbox that shows the added alarms.
1. set alarm time via txtAlarmTime
2. add text or vba command to run
3. click btnAddAlarm and run the code in the module if vba command, else display text on timed event
4. lstAlarms displays the alarms that have been added.
-
- Administrator
- Posts: 78675
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SQL Statement, One More Time
Should the list box display the alarm times, the function names, or both?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
-
- Administrator
- Posts: 78675
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SQL Statement, One More Time
OK. Make sure that the list box has the following properties:
Column Count: 3
Column Widths: 0
Row Source Type: Table/Query
Row Source: tblAlarms
txtAlarmTime and txtFunctionName should be unbound (their Control Source should be blank)
Create an On Click event procedure for btnAddAlarm:
Column Count: 3
Column Widths: 0
Row Source Type: Table/Query
Row Source: tblAlarms
txtAlarmTime and txtFunctionName should be unbound (their Control Source should be blank)
Create an On Click event procedure for btnAddAlarm:
Code: Select all
Private Sub btnAddalarm_Click()
If IsNull(Me.txtAlarmTime) Then
Me.txtAlarmTime.SetFocus
MsgBox "Please enter the alarm time!", vbExclamation
Exit Sub
End If
If IsNull(Me.txtFunctionName) Then
Me.txtFunctionName.SetFocus
MsgBox "Please enter the function name!", vbExclamation
Exit Sub
End If
CurrentDb.Execute "INSERT INTO tblAlarms (AlarmTime, FunctionName) VALUES (#" & _
Format(Me.txtAlarmTime, "mm/dd/yyyy hh:mm:ss AM/PM") & "#, '" & _
Me.txtFunctionName & "')", dbFailOnError
Me.lstAlarms.Requery
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 550
- Joined: 30 Jul 2014, 23:58
Re: SQL Statement, One More Time
Thank You Hans for your hard work.