Hello everyone, pardon me, if i make some mistake, because i still on learning curve.
anyway.. after searching on multiple forum i still had no answer how to get xform value because it on 5 differ forms.
so what i was looking for is a way to get the button name when button find on 5 different forms clicked:
if plausible specific only to below button
1) frmmchfpdata, cmdfind615
2) frmmchobdata, cmdfind617
3) frmmchu7data, cmdfind619
4) frmopddata, cmdfind215
5) frmopdflupdata, cmdfind217
below code on ok button at popup form named as frmsrhstudent.
anyway.. after searching on multiple forum i still had no answer how to get xform value because it on 5 differ forms.
so what i was looking for is a way to get the button name when button find on 5 different forms clicked:
if plausible specific only to below button
1) frmmchfpdata, cmdfind615
2) frmmchobdata, cmdfind617
3) frmmchu7data, cmdfind619
4) frmopddata, cmdfind215
5) frmopdflupdata, cmdfind217
below code on ok button at popup form named as frmsrhstudent.
Code:
[FONT=Tahoma][SIZE=2]
Private Sub Command0_Click()
Dim Srch As String
Dim Srchx As String
Dim xbtnname As String
Let [/SIZE][/FONT][FONT=Tahoma][SIZE=2][FONT=Tahoma][SIZE=2]xbtnname [/SIZE][/FONT] = ???? ....> any idea? to refer thing said above, require function? if yes how?
Select Case [/SIZE][/FONT][FONT=Tahoma][SIZE=2][FONT=Tahoma][SIZE=2]xbtnname [/SIZE][/FONT]
'Go to below line based on Which button press(by it name) ?
'1)if button find on frmmchfpdata clicked
Case "cmdfind615"
If IsNull(Text3) = True Then
MsgBox "Please enter studentID", vbOKOnly
Else
Srch = "SELECT * FROM [qrymchfpdata] WHERE [studentID] LIKE '*" & Me.Text3 & "*';"
Forms("frmmchfpdata").RecordSource = Srch
End If
If IsNull(Form_frmmchfpdata!studentIDtxt) = False Then
MsgBox "Record found.", vbOKOnly
Else
MsgBox "Record not found! Displaying example record", vbRetryCancel
End If
If IsNull(Form_frmmchfpdata!studentIDtxt) = True Then
Srchx = "SELECT * FROM [qrymchfpdata] WHERE REGDATE IN (SELECT min(REGDATE) FROM qrymchfpdata);"
Forms("frmmchfpdata").RecordSource = Srchx
End If
'2)if button find on frmmchobdata clicked
Case "cmdfind617"
If IsNull(Text3) = True Then
MsgBox "Please enter studentID", vbOKOnly
Else
Srch = "SELECT * FROM [qryfrmmchobdata] WHERE [studentID] LIKE '*" & Me.Text3 & "*';"
Forms("frmmchobdata").RecordSource = Srch
End If
If IsNull(Form_frmmchobdata!studentIDtxt) = False Then
MsgBox "Record found.", vbOKOnly
Else
MsgBox "Record not found! Displaying example record", vbRetryCancel
End If
If IsNull(Form_frmmchobdata!studentIDtxt) = True Then
Srchx = "SELECT * FROM [qrymchobdata] WHERE REGDATE IN (SELECT min(REGDATE) FROM qrymchobdata);"
Forms("frmmchobdata").RecordSource = Srchx
End If
'3)if button find on frmmchu7data clicked
Case "cmdfind619"
If IsNull(Text3) = True Then
MsgBox "Please enter studentID", vbOKOnly
Else
Srch = "SELECT * FROM [qrymchu7data] WHERE [studentID] LIKE '*" & Me.Text3 & "*';"
Forms("frmmchu7data").RecordSource = Srch
End If
If IsNull(Form_frmmchu7data!studentIDtxt) = False Then
MsgBox "Record found.", vbOKOnly
Else
MsgBox "Record not found! Displaying example record", vbRetryCancel
End If
If IsNull(Form_frmmchu7data!studentIDtxt) = True Then
Srchx = "SELECT * FROM [qrymchu7data] WHERE REGDATE IN (SELECT min(REGDATE) FROM qrymchu7data);"
Forms("frmmchu7data").RecordSource = Srchx
End If
'4)if button find on frmopddata clicked
Case "cmdfind215"
If IsNull(Text3) = True Then
MsgBox "Please enter studentID", vbOKOnly
Else
Srch = "SELECT * FROM [qryopddata] WHERE [studentID] LIKE '*" & Me.Text3 & "*';"
Forms("frmopddata").RecordSource = Srch
End If
If IsNull(Form_frmopddata!studentIDtxt) = False Then
MsgBox "Record found.", vbOKOnly
Else
MsgBox "Record not found! Displaying example record", vbRetryCancel
End If
If IsNull(Form_frmopddata!studentIDtxt) = True Then
Srchx = "SELECT * FROM [qryopddata] WHERE REGDATE IN (SELECT min(REGDATE) FROM qryopddata);"
Forms("frmopddata").RecordSource = Srchx
End If
'5)if button find on frmopdflupdata clicked
Case "cmdfind217"
If IsNull(Text3) = True Then
MsgBox "Please enter studentID", vbOKOnly
Else
Srch = "SELECT * FROM [qryopdflupdata] WHERE [studentID] LIKE '*" & Me.Text3 & "*';"
Forms("frmopdflupdata").RecordSource = Srch
End If
If IsNull(Form_frmopdflupdata!studentIDtxt) = False Then
MsgBox "Record found.", vbOKOnly
Else
MsgBox "Record not found! Displaying example record", vbRetryCancel
End If
If IsNull(Form_frmopdflupdata!studentIDtxt) = True Then
Srchx = "SELECT * FROM [qryopdflupdata] WHERE REGDATE IN (SELECT min(REGDATE) FROM qryopdflupdata);"
Forms("frmopdflupdata").RecordSource = Srchx
End If
End Sub
[/SIZE][/FONT]