Using Access 2007 to track the company's wireless devices.
FrmMain has fields for Common Name, Dept, Cell Number, Datacard number, etc. It also has various buttons to launch other forms, queries or macros.
FrmMain is based off a query that queries various tables (tblUser, tblDevices, etc)
When a user calls in I can type the user's name or mobile number in the search fields at the top of FrmMain and the form will populate with all the user's info.
If the user has a problem (lost it, broke it, got it wet, and so on) I create a ticket by pressing a button titled "Cell Events".
The Cell Events button opens frmEvent-View with the following fields: Wireless Number, Event Date, User, Problem, and Event Description in Tabular format.
This form is based on tblEvents (not a query) and is filtered to display only events pertaining to the cell number populated in FrmMain .
Example: Sally Berry calls with a lost phone. I type in "Sally Berry" in the search field on FrmMain and populate the form with her info including her cell number, 999-123-9999
I click the Cell Events Button and frmEvent-View opens displaying two entries for mobile number 999-123-9999 and a blank entry beneath them for me to fill out. Whatever I type in those blank fields creates a new record in tblEvents.
Right now I have to type or copy/paste the info in.
I put a button at the top right hand corner of the frmEvent-View called[highlight] Add Event[/highlight]. When I click the button I would like for the Wireless Number and User name to auto fill based on username and cell number in FrmMain (which is open at the time) and for the Date to be filled in with the current date.
So basically I want VBA to do the following when I click on the[highlight] Add Event[/highlight] button:
1) Copy the text in [FrmMain].[Common Name] and paste in [frmEvent-View].[User]
2) Copy text in [FrmMain].[Cell Number] and paste in [frmEvent-View].[Wireless Number]
3) Put the current date in [frmEvent-View].[Event Date]
I'm new to VBA so bear with me here. I have tried the following:
Private Sub Add_Cell_Event_Click()
'Add the string variables,
Dim strCell As String
Dim strUser As String
'set the string variable to the contents of the text boxes
strCell = Forms!frmMain2![Cell Number]
strUser = Forms!frmMain2![Common Name]
'Copy set values above to the corresponsing text boxes on frmView Events
[Wireless Number] = strCell
[User] = strUser
END SUB
I have also tried these other syntax I found online:
frmMain![cell number] = Me![wireless number]
[Forms]![frmMain]![cell number] = [wireless number]
Form![frmMain]![cell number] = Me.[wireless number]
Any suggestions and tips on using VBA are most appreciated. Thanks.
FrmMain has fields for Common Name, Dept, Cell Number, Datacard number, etc. It also has various buttons to launch other forms, queries or macros.
FrmMain is based off a query that queries various tables (tblUser, tblDevices, etc)
When a user calls in I can type the user's name or mobile number in the search fields at the top of FrmMain and the form will populate with all the user's info.
If the user has a problem (lost it, broke it, got it wet, and so on) I create a ticket by pressing a button titled "Cell Events".
The Cell Events button opens frmEvent-View with the following fields: Wireless Number, Event Date, User, Problem, and Event Description in Tabular format.
This form is based on tblEvents (not a query) and is filtered to display only events pertaining to the cell number populated in FrmMain .
Example: Sally Berry calls with a lost phone. I type in "Sally Berry" in the search field on FrmMain and populate the form with her info including her cell number, 999-123-9999
I click the Cell Events Button and frmEvent-View opens displaying two entries for mobile number 999-123-9999 and a blank entry beneath them for me to fill out. Whatever I type in those blank fields creates a new record in tblEvents.
Right now I have to type or copy/paste the info in.
I put a button at the top right hand corner of the frmEvent-View called[highlight] Add Event[/highlight]. When I click the button I would like for the Wireless Number and User name to auto fill based on username and cell number in FrmMain (which is open at the time) and for the Date to be filled in with the current date.
So basically I want VBA to do the following when I click on the[highlight] Add Event[/highlight] button:
1) Copy the text in [FrmMain].[Common Name] and paste in [frmEvent-View].[User]
2) Copy text in [FrmMain].[Cell Number] and paste in [frmEvent-View].[Wireless Number]
3) Put the current date in [frmEvent-View].[Event Date]
I'm new to VBA so bear with me here. I have tried the following:
Private Sub Add_Cell_Event_Click()
'Add the string variables,
Dim strCell As String
Dim strUser As String
'set the string variable to the contents of the text boxes
strCell = Forms!frmMain2![Cell Number]
strUser = Forms!frmMain2![Common Name]
'Copy set values above to the corresponsing text boxes on frmView Events
[Wireless Number] = strCell
[User] = strUser
END SUB
I have also tried these other syntax I found online:
frmMain![cell number] = Me![wireless number]
[Forms]![frmMain]![cell number] = [wireless number]
Form![frmMain]![cell number] = Me.[wireless number]
Any suggestions and tips on using VBA are most appreciated. Thanks.